Пример #1
0
def ft_channels_editFirst():    
    obj = deal_mysql()
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    result = obj.askdata(msg)
    headers = ["频道名称"]
    print(yate.start_response())
    print(yate.include_header("频道维护"))       
    print(yate.start_form("ft_channels_edit.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))  
    print(yate.start_row())
    print(yate.select('which_chid'))
    #for array in result:        
    print(yate.select_option(result))
    print(yate.end_select())
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())   
    obj.Close()
Пример #2
0
def channels_offline(channel_offline=True):
    message = ("""SELECT ulv_genchannels.channel_id,
    tvs_channel.chname, 
    ulv_genaddress.gen_address, 
    ulv_status.des
    FROM ulv_genchannels
    NATURAL JOIN tvs_channel, ulv_genaddress, ulv_status
    WHERE ulv_genchannels.channel_id = tvs_channel.chid 
    AND tvs_channel.chid = ulv_genaddress.channel_id 
    AND ulv_status.status_id=1 order by ulv_genchannels.sort_id, ulv_genchannels.channel_id""")

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "频道编号", "直播路径", "发布状态"]
    print(yate.start_response())
    if channel_offline:
        print(yate.include_header("频道下线"))
    else:
        print(yate.include_header("已发布频道"))
    print(yate.start_form("ft_channels_offline.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    
    for array in result:
        print(yate.do_table(array, channel_offline))

    print(yate.end_table())
    if channel_offline==True:
        print(yate.end_form("确定"))
Пример #3
0
def channels():
    message = """select live_channel.chid,tvs_channel.chname,live_server.live_ip,live_url.live_path,live_status.sname """
    message += """from tvs_channel,live_channel,live_server,live_url,live_status where tvs_channel.chid=live_channel.chid and """
    message += """live_status.statusid=live_channel.statusid and live_url.live_urlid=live_channel.live_urlid and live_url.serverid = live_server.serverid """
    message += """and live_url.status=0 order by live_channel.chid """

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "直播地址", "直播路径", "发布状态"]
    print(yate.start_response())
    print(yate.include_header("JSB living system"))
    print(yate.start_form("edit.py"))
    print(yate.start_table(tb_width="80%", tb_border="1px solid"))
    print(yate.tb_caption("已发布频道"))
    print(yate.tb_header(headers))

    for array in result:
        print(yate.tb_data(array[1:]))
    print(yate.end_table())
    print(yate.end_form())
    print(yate.include_footer({"Home": "/index.html"}))
Пример #4
0
def ft_channels_edit_second():
    start_response()
    chid = get_formData('which_chid')
    obj = deal_mysql()
    msg = ("""SELECT ulv.channel_id,tvs.chname,ulv.gen_address 
    from ulv_genaddress as ulv inner join tvs_channel as tvs 
    on ulv.channel_id=tvs.chid and ulv.channel_id=%s""" % chid[0])
    result = obj.askdata(msg)
    info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("频道修改"))       
    print(yate.start_form("ft_channels_editDone.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())
    print(yate.checked_radio_button('which_chid',[info[0],info[1]]))
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.input_text("which_addr",info[2]))
    print(yate.end_row())     
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Пример #5
0
def select_sp():    
    
    obj = deal_mysql("uspset.ini")
    msg =  '''select id,name from u_sp'''
    results = obj.askdata(msg)
    obj.Close()
    
    headers = ["运营商名称"]
    print(yate.start_response())
  
    print(yate.include_header("首页运营"))

    print(yate.start_form("op_guidepage_arrange.py"))    
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in results:
        print(yate.start_row())
        print(yate.checked_radio_button('which_spid',[array[0],array[1]]))
        print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())        
Пример #6
0
def channels_operation(sp_id):  
    chidDic  = dict() #store the checked chid from sp_id
    obj = deal_mysql()
    
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    msgn = ('''SELECT chid,sp_id from ulv_opchannels where sp_id=%d''' % int(sp_id))
    
    result = obj.askdata(msg)    
    checked = obj.askdata(msgn)
    for ele in checked:
        chidDic[ele[0]] = ele[1]
    nobj = deal_mysql('uspset.ini')
    msgs = '''select name from u_sp where id=%s''' % int(sp_id)
    response = nobj.askdata(msgs)
    
    headers = ["频道名称", "频道编号"]
    print(yate.start_response())
  
    print(yate.include_header("频道运营"))

    print(yate.start_form("op_channels_generate.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    theader = ['运营商']
    print(yate.tb_header(theader))
    print(yate.start_row())
    print('<input type="radio" checked="checked" name="which_sp" value="'+(sp_id)+'"/>"'+response[0][0]+'"')
    print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in result:
        if chidDic.get(array[0],None)==None:
            print(yate.do_operationtable(array))
        else:
            print(yate.checked_operationtable(array))
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())    
    obj.Close()
    nobj.Close()
Пример #7
0
def channels_publish():
    cmdmsg = ("""SELECT tvs_channel.chid, tvs_channel.chname
    FROM tvs_channel
    NATURAL JOIN ulv_genaddress
    WHERE tvs_channel.`status` <> 1 AND tvs_channel.chid = ulv_genaddress.channel_id
    order by tvs_channel.chid""")
    
    conn = my_sql.connect()
    cur = conn.cursor()
    cur.execute(cmdmsg)
    result = cur.fetchall()
    
    msg = ("""select sort_id,sort_name from ulv_sort""")
    cur.execute(msg)
    sortinfo = cur.fetchall()
    conn.close()

    print(yate.start_response())
    print(yate.include_header("上线频道"))
    print("<p ><b>通过下面的复选框选择要上线的频道</b></p>")    
    print(yate.start_form("ft_channels_publish.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print("<center>")   
    print(yate.select("channel_id"))
    print(yate.select_option(result))
    print(yate.end_select())  
    print('</center>')
    print(yate.end_row())
    
    print(yate.start_row())
    print("<center>")
    print(yate.select("sort_id"))
    print(yate.select_option(sortinfo))
    print(yate.end_select()) 
    print('</center>')
    print(yate.end_row())    
    
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
Пример #8
0
def do_web_process():
    #test functions for yate.py
    print(yate.start_response())
    print(yate.start_response("text/plain"))
    print(yate.start_response("application/json"))
    print(yate.include_header("Test title for my web application in python test"))
    print(yate.include_footer({'Home':'/index.html', 'Select':'/cgi-bin/select.py'}))
    print(yate.start_form("/cgi-bin/process-athlete.py"))
    #print(urllib.request.urlopen('http://192.168.0.1/test.py', urllib.parse.urlencode({'a':'c'})))
    print(urllib.parse.urlencode({'a':'c'}))
    
    the_files = ['testdata/sarah2.txt', 'testdata/james2.txt', 'testdata/mikey2.txt']
    data = put_to_store(the_files)
    for each_data in data:
        print(data[each_data].name+' '+data[each_data].dob)
    data_copy = get_from_store()
    for each_data in data_copy:
        print(data_copy[each_data].name+' '+data_copy[each_data].dob)
    #start simple http server for test
    simple_http_server_test()
    pass
Пример #9
0
def channels_collect():
    start_response()    
    obj = deal_mysql()
    msg = ("""SELECT chid,chname from tvs_channel where status=0""")         
    result = obj.askdata(msg)
    #info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("新频道收录"))       
    print(yate.start_form("ft_channels_collectDone.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())   
    print(yate.select('which_chid'))               
    print(yate.select_option(result))
    print(yate.end_select())    
    print('<input type="text" name="which_addr" />')
    print(yate.end_row())      
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Пример #10
0
def print_operationboundary():
    obj = deal_mysql('uspset.ini')
    msg = '''select id,name from u_sp;'''
    response = obj.askdata(msg)
    headers = ["运营商"]
    print(yate.start_response())
    print(yate.include_header("运营发布"))     
   
    print("<p ><b>点击下面的运营商名称可选择要发布的频道</b></p>")            
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))     
    print(yate.start_div('channel_div'))
    print(yate.start_form("op_channels_select.py"))
    for element in response:
        print('<tr><td>')        
        print(yate.radio_button("which_sp",element)) 
        print('</tr></td>')        
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    print(yate.end_div())          
    obj.Close()
#! /usr/local/bin/python3

import athletelist_model  #loaded model file
import yate  #html help file
import glob   #to list the data files

data_files=glob.glob("data/*.txt")
athletes=athletelist_model.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("athletelist_generate_time.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:
    print(yate.radio_button("which_athlete",athletes[each_athlete].name))

print(yate.end_form("Select")) 
print(yate.include_footer({"Home": "/index.html"}))  #argument is dictiornary list
Пример #12
0
import athletemodel
import yate
import glob
# import os
# os.chdir('D:/Python/python-git/begginger/2017-03-13/Program')

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())  # 总是从一个content-type行开始
print(yate.include_header(
    "Coach Kelly's List of Athletes"))  # 开始生成Web页面,提供一个合适的标题
print(yate.start_form("generate_timing_data.py"))  # 开始生成表单,提供要连接的服务器端程序的名。
print(yate.para(
    "Select an athlete from the list to work with:"))  # 这是一个段落,告诉用户做什么

# 为每个选手分别生成一个单选钮
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))  # 定制一个"提交"按钮

print(yate.include_footer({"Home": "/index.html"}))
Пример #13
0
import glob
import model
import yate

data_files = glob.glob("../data/*.txt")
img_dic = model.writeList(data_files)


print (img_dic)


print (yate.start_response())
print (yate.include_header("haha"))
print (yate.start_form("by my CGI"))
print (yate.para("from my data list"))
for item in img_dic:
    print(yate.radio_button("which_img",img_dic[item] ))
print(yate.end_form("Selec"))
print(yate.include_footer({"HOME": "/index.html"}))

Пример #14
0
                (athlete_id, timing_data))

    cursor.execute("SELECT * FROM athletes WHERE name = ?", ("James Lee", ))
    print(cursor.fetchall(), file=sys.stderr)
    cursor.execute("SELECT * FROM timing_data WHERE athlete_id = ?", (1, ))
    print(cursor.fetchall(), file=sys.stderr)
    connection.commit()
    connection.close()

connection = sqlite3.connect("target/coach_data.sqlite")
cursor = connection.cursor()

cursor.execute("SELECT name FROM athletes")
play_names = [row[0] for row in cursor.fetchall()]

print(yate.start_response())
print(
    yate.include_header(
        "Coack Kelly's List of Plays, attention: data comes from sqlite3"))
print(yate.start_form("add_timing_data.py"))
print(yate.para("Click here to select an play you want to add timing data"))
for play_name in play_names:
    print(yate.radio_button("which_player", play_name))
print("Entering a timing value:")
print(yate.text_input("time_value"))
print(yate.end_form("Select to add or show detail"))
print(yate.include_footer({"Click here to go Home": "/index.html"}))

connection.commit()
connection.close()
Пример #15
0
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 11:50:51 2018

@author: dell]

generate_list
"""

import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:
    print(yate.radio_button("Which_athlete", athletes[each_athlete].name))
print(yate.end_form("select"))

print(yate.include_footer({"Home": "/index.html"}))
Пример #16
0
__author__ = 'micheng'

import athletemodel
import yate
import glob
import cgitb

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("NUAC's List of Athletes"))
print(yate.start_form("generate_data_web.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in sorted(athletes):
    print(yate.radio_button_id("which_athlete", each_athlete[0], str(each_athlete[1])))
print(yate.end_form("Select"))

print(yate.include_footer({"See the Champion": "/cgi-bin/champion.py"}))

print(yate.include_footer({"Home":"/index.html"}))
#! /usr/local/bin/python3

import glob

import athletemodel
import yate

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("cgi-bin/generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Пример #18
0
#! /usr/local/bin/python3
#点击查看成绩的时候调用这个函数
import cgitb
cgitb.enable()

import athletemodel
import cgi
import yate

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("运动员的成绩"))
print(yate.start_form("generate_timing_data.py"))  #选择想要查询的运动员名字后,执行这个脚本
print(yate.para("选择你想要查询的运动员: "))

for each_athlete in athletes:
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             each_athlete[1]))
    #print(each_athlete[0],each_athlete[1])
print(yate.end_form("查询"))

print(yate.include_footer({"返回主页": "/index.html"}))
Пример #19
0
cur.execute("""select logoid,chname from live_logo """)
logodic = cur.fetchall()
alllogoname = {}
for each in logodic:
    alllogoname[each[0]] = each[1].encode('utf-8')

#select catagory id
cur.execute("""select sort_id,sort_name from live_sort """)
catagorydic = cur.fetchall()
allcatagory = {}
for each in catagorydic:
    allcatagory[each[0]] = each[1].encode('utf-8')
    
print(yate.start_response())
print(yate.render_publish())
print(yate.start_form("edit.py"))    


print(yate.select('cid'))
print(yate.select_list_n(allchannel))
print(yate.end_select())

print(yate.select('catagory'))
print(yate.select_list_n(allcatagory))
print(yate.end_select())
"""
print(yate.select('serverip'))
print(yate.select_list_n(allserver))
print(yate.end_select())

print(yate.select('storagepath'))
Пример #20
0
def guidpage_arrange():
    spid = get_formData('which_spid')
    obj = deal_mysql()
    msg = '''select id,alias from u_items'''
    results = obj.askdata(msg)
    
    nummsg = '''select item_id,position from u_homepage where spid=%s''' % spid[0]
    homeitem= obj.askdata(nummsg)   
    
    obj.Close()
    
    nobj = deal_mysql('uspset.ini')
    nmsg = """select name from u_sp where id=%s""" % spid[0]
    spname = nobj.askdata(nmsg)   
    nobj.Close()
      
    
    #headers = ["频道名称", "频道编号"]
    print(yate.start_response())
    aa = "频道运营"
    aa.encode('utf-8')
  
  
    print(yate.include_header(aa))

    print(yate.start_form("op_guidepage_storage.py"))
    
    print(yate.start_table(tb_width="75%", tb_border="1px solid"))    
    print(yate.start_row())
    print('<input type="radio" checked="checked" name="which_sp" value="'+(spid[0])+'"/>"'+spname[0][0]+'"')
    
    print(yate.end_row())
    print(yate.end_table())
    
    print(yate.start_table(tb_width="75%", tb_border="5px solid")) 
    '''
    spid has in u_homepage
    '''
    if homeitem !=():        
        position = dict()
        for eachItem in homeitem:
            position.update({eachItem[0]:eachItem[1]})
        for i in range(2):    
            print(yate.start_tr())
            for iters in range(3):
                if i == 1:
                    iters = iters + 3
                print(yate.start_td())
                pos = 'pos'+str(iters)
                print(yate.select(pos))
                for item in results:
                    if item[0] in position.keys() and position[item[0]]==iters+1:                        
                        print(yate.select_optione_with_selected(item,True))
                    else:
                        print(yate.select_optione_with_selected(item))                        
                print(yate.end_select())
                print(yate.end_td())
            print(yate.end_tr())
                     
    
    else:
        for i in range(2):                          
            print(yate.start_tr())        
            for iters in range(3):
                if i == 1:
                    iters = iters + 3
                print(yate.start_td())
                pos = 'pos'+str(iters)
                print(yate.select(pos))        
                print(yate.select_option(results))
                print(yate.end_select())
                print(yate.end_td())
            print(yate.end_tr())    
    
    print(yate.end_table())
    
    print(yate.start_table(tb_width="75%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())    
    print(yate.end_table())  
    print('</body></html>')
Пример #21
0
import athletemodel
import yate
import glob

data_files = glob.glob('data/*.txt')
athletes = athletemodel.put_to_store(data_files)
print(yate.start_response())
print(yate.include_header('coach kelly list of athlete'))
print(yate.start_form('generate_timing_data.py'))
print(yate.para('select an athlete from the list to work with:'))
for each_athlete in athletes:
    print(yate.radio_button('which_athlete', athletes[each_athlete].name))
print(yate.end_form('select'))

print(yate.include_footer({'Home': '/index.html'}))
Пример #22
0
__author__ = 'Dixit_Patel'

from genericFunctions import *
import athletemodel
#from athletemodel import *
import yate
import glob

data_files = glob.glob("data/*.txt")
print(glob.glob0('data','/*.txt'))
print(glob.glob1('data','/*.txt'))
athletes = athletemodel.put_to_store(data_files)
print(yate.header("ATHLetA"))
print(yate.para('Select an athlete from list'))
print(yate.start_form(''))
print(type(athletes))
for athlete in athletes:
    print(yate.radio_button("which_athlete",athletes[athlete].name))
# print(yate.radio_button('James','James'))
# print(yate.radio_button('Mikey','Mikey'))
print(yate.end_form())
print(yate.include_footer({"Home": "/index.html"}))
Пример #23
0
if not sig and cid:  
    cursor.execute(message)
    conn.commit()
conn.close()


#select form order_list and show in tables
dics = {}
info = """select live_channel.chid,tvs_channel.chname,live_server.live_ip,live_server.storage_addr,live_status.sname """
info1 = """from tvs_channel,live_channel,live_server,live_status where tvs_channel.chid=live_channel.chid and """
info2 = """live_status.status=live_channel.statusid and live_server.chid=live_channel.chid order by tvs_channel.chid ASC """

message = info + info1 + info2
#print message

conn = mysql.connect()
cursor = conn.cursor()
cursor.execute(message)
result = cursor.fetchall()
conn.close()    
#print dics
print(yate.start_form('edit.py'))
print(yate.do_table_head())

for array in result:
    #print array[0]
    print(yate.do_table(array[0],array[1],array[2],array[3],array[4]))    
print(yate.do_table_end())


Пример #24
0
#! /usr/local/bin/python3
# -*- coding: utf-8 -*-

import yate, cgi, json, cgitb
from collections import OrderedDict

cgitb.enable()
form_data = cgi.FieldStorage()
score = 0  #初始化考试成绩
RightNum = 0
# =================== 下面是实例化考试成绩判断对象 ===================
print(yate.start_response())
print(yate.include_header('欢迎来到韦浩宇的算术运算训练营!'))

print(yate.start_form('page_test.py'))
print(yate.input_hidden('testlist', 'apple'))
print(yate.input_hidden('testlist', 'banana'))
print(yate.end_form('确定', 'sub'))

try:
    for Afruit in form_data['testlist']:
        print(yate.header('这是一个%s' % Afruit.value, 2))

except KeyError:
    print('<script>alert(\'%s\')</script>' % ('发生错误,没有获取到任何一个水果!---->'))

# =====================设置页脚的链接(保持固定顺序)=====================
FooterString = OrderedDict()
FooterString['返回首页'] = '/index.html'
FooterString['考题回顾'] = '#'
print(yate.include_footer(FooterString))
Пример #25
0
            'document.form.totaltime.value = totalseconds}var timer=setTimeout("countdown()",1000);'

# =================== 下面是生成考试页面 ===================

print(yate.start_response())
print(yate.include_header_js('欢迎来到韦浩宇的算术运算训练营!', JS_string))
# print(yate.start_form('arithmetic_training_games.py'))
print('<div id="topfixed">')
print(yate.header('欢迎来到韦浩宇的算术运算训练营!', 1))
print(
    yate.header(
        '开始算术测验%s<span class="timeshow">开始计时:</span><span  id="timeshow" class="timeshow"></span>'
        % ('&nbsp;' * 8), 2))
print('</div>')
print('<div style="margin-top:125px">')
print(yate.start_form('exam_result.py', name='form'))

for key in sorted(ExamList.keys()):
    ExamData = 'ExamData' + str(key)  #在页面上记录本次考题和答案
    print(yate.input_hidden(ExamData, str(key)))
    print(yate.input_hidden(ExamData, ExamList[key][0]))
    print(yate.input_hidden(ExamData, str(ExamList[key][1])))
    print(
        yate.header(
            '<span class="specfont">%d.</span>&nbsp;&nbsp;&nbsp;&nbsp;%s' %
            (key, ExamList[key][0] + ' = &nbsp;&nbsp;' +
             yate.create_inputs(ExamData, style='input_control')), 2))
# ================= 在页面上记录上之前的设置参数 =================
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in OperatorList:
    print(yate.input_hidden('operator', Operator))
Пример #26
0
#! /usr/bin/env python

import athletemodel
import yate
import cgitb

#cgitb.enable()

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("NUAC's List of Athletes"))
print(yate.start_form('generate_timing_data.py'))
print(yate.para('Select an athlete from the list to work with: '))

for each_athlete in sorted(athletes):
    print(yate.radio_button_id('which_athlete', each_athlete[0], each_athlete[1]))
print(yate.end_form('Select'))

print(yate.include_footer({'Home': '/index.html'}))
Пример #27
0
try:
    with open(RecordFilePath, mode='r', encoding='utf-8') as readfile:
        jsonstring = json.loads(readfile.read().strip())
        ExamRecDict = OrderedDict()
        for Arec in sorted(jsonstring['ExamRecords'].keys(), reverse=True):
            for AnExam in jsonstring['ExamRecords'][Arec]:
                WrongCount = WrongCount + len(
                    jsonstring['ExamRecords'][Arec][AnExam]['WrongRecords'])
            ExamRecDict[Arec] = Arec + '(%d | %d)' % (len(
                jsonstring['ExamRecords'][Arec]), WrongCount)

    print('<div id="topfixed">')
    print(yate.header('韦浩宇的算术训练营 -- 测验回顾', 1))
    print(yate.para('请选择查看哪天的测验?'))
    print(yate.start_form('ExamRecords.py'))
    print(yate.select_set('ExamRecSelect', ExamRecDict))
    print(yate.end_form('确定', 'sub'))

    try:
        Recordkey = form_data['ExamRecSelect'].value
        print(yate.para(''))
        print(
            yate.header(
                '以下为 <ins>%s</ins> 的测验记录(共 <ins>%d</ins> 次):' %
                (Recordkey, len(jsonstring['ExamRecords'][Recordkey])), 2))
        print('</div>')
        print('<div style="margin-top:220px">')
        for AnExam in sorted(jsonstring['ExamRecords'][Recordkey].keys()):
            ExamWrongList = jsonstring['ExamRecords'][Recordkey][AnExam][
                'WrongRecords']
Пример #28
0
}\
function ExamAction(){\
    document.name.action="exam.py";\
    document.name.submit();\
}'

# SubURLS = OrderedDict()
# SubURLS['自由练习'] = 'FreeExerAction()'
# SubURLS['进行测验'] = 'ExamAction()'

# =================生成一个HTML页面=================
print(yate.start_response())
print(yate.include_header_js('设置算术表达式的生成参数!', Form_JS))
print(yate.header('设置算术表达式的生成参数!', 1))
# print(yate.para('%s' %('=' * 10 + '请设置算术表达式的生成参数' + '=' * 10)))
print(yate.start_form('', 'name'))
print(yate.para('1.请设置计算值范围'))
print(yate.select_set('numlist', NumList, SelectedVals=numlist_checked))
print(yate.para('2.请设置使用的运算符'))
for key in OperatorList:
    checkedVal = False
    if (OperatorList[key][0] in operator_checked):
        checkedVal = True
    print(
        yate.checked_box('operator',
                         OperatorList[key][0],
                         OperatorList[key][1],
                         key,
                         checked=checkedVal))
print(yate.para('3.请设置计算数个数'))
print(yate.select_set('level', NumLevel, SelectedVals=level_checked))
Пример #29
0
#! /usr/local/bin/python3

import athletemodel_sqlite3
import yate

athletes = athletemodel_sqlite3.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data_sqlite3.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in sorted(athletes):
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             each_athlete[1]))

print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index_sqlite3.html"}))
Пример #30
0
__author__ = 'micheng'

import athletemodel
import yate
import glob
import cgitb

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("NUAC's List of Athletes"))
print(yate.start_form("generate_data_web.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in sorted(athletes):
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             str(each_athlete[1])))
print(yate.end_form("Select"))

print(yate.include_footer({"See the Champion": "/cgi-bin/champion.py"}))

print(yate.include_footer({"Home": "/index.html"}))
            'setTimeout("countdown()",1000);totalseconds ++;if(downtime==1){time.setSeconds(second-1);timeshow.style.color="#0099CC";}' \
            'else{time.setSeconds(second+1);timeshow.style.color="#0099CC";}' \
            'hour<10?hour="0"+hour:hour;min<10?min="0"+min:min;second<10?second="0"+second:second;timeshow.innerHTML=timeOutText+hour+":"+min+":"+second;' \
            'document.form.totaltime.value = totalseconds}var timer=setTimeout("countdown()",1000);'

# =================生成一个HTML页面=================
print(yate.start_response())
print(yate.include_header_js('欢迎来到韦浩宇的算术运算训练营!', JS_string))
# print(yate.start_form('arithmetic_training_games.py'))
print(yate.header('欢迎来到韦浩宇的算术运算训练营!', 1))
print(yate.header(header_string1, 2))
print(
    yate.header(
        '第 %d 题, 计时:<span id="timeshow"></span> ----> 已答对<font color = "green"> %d </font>题,答错<font color="red"> %d </font>题(已纠正 <font color="blue"> %d </font>题)'
        % (ExpNum, RightAnsNum, WrongNum, CorrectNum), 4))
print(yate.start_form('generate_expression.py', name='form'))

# =================在页面上记录上之前的设置参数=================
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in OperatorList:
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('ArithmeticExpress', ArithmeticExpress))
print(yate.input_hidden('FactResult', FactResult))
print(yate.input_hidden('ExpNum', ExpNum))
print(yate.input_hidden('WrongNum', WrongNum))
print(yate.input_hidden('WrongTag', WrongTag))
print(yate.input_hidden('CorrectNum', CorrectNum))
print(yate.input_hidden('NewSetting', NewSettingTag))  #设置是否为新设置的标识(其他页面为0)
print(yate.input_hidden('RightAnsNum', RightAnsNum))
print(yate.input_hidden('RegenerationTag', 0))
Пример #32
0
RecordFilePath = 'data/WrongRecord.json'  #指定错误题目记录文件路径
form_data = cgi.FieldStorage()

print(yate.start_response())
print(yate.include_header('韦浩宇的算术训练营 -- 错题回顾'))

try:
    with open(RecordFilePath, mode='r', encoding='utf-8') as readfile:
        jsonstring = json.loads(readfile.read().strip())
        WrongRecDict = OrderedDict()
        for Arec in sorted(jsonstring.keys(), reverse=True):
            WrongRecDict[Arec] = Arec + '(<span style="color:red">' + str(
                len(jsonstring[Arec])) + '</span>)'

    print(yate.para('请选择查看哪天的错题?'))
    print(yate.start_form('WrongRecord.py'))
    print(yate.select_set('WrongRecSelect', WrongRecDict))
    print(yate.end_form('确定', 'sub'))

    try:
        Recordkey = form_data['WrongRecSelect'].value
        print(yate.para(''))
        print(
            yate.header(
                '以下为 <ins>%s</ins> 的错题记录(共 <ins>%d</ins> 道):' %
                (Recordkey, len(jsonstring[Recordkey])), 2))
        print(yate.u_list(jsonstring[Recordkey]))
    except KeyError:
        pass
    finally:
        print(yate.header('', 2))
Пример #33
0
    #         if (0 <= FactResult <= MaxNum):
    #             break
    #     except ZeroDivisionError:
    #         continue
    # action_URL = 'judge_result.py'
    header_string1 = '请输入计算结果再提交'

    # re_answer_tag = 1


# if(header_string1):
print(yate.header(header_string1,3))
print(yate.header(
    '第 %d 题  ----> 已答对<font color = "green"> %d </font>题,答错<font color="red"> %d </font>题(已纠正 <font color="blue"> %d </font>题)'
    % (ExpNum, (ExpNum - WrongNum - 1), WrongNum, CorrectNum), 4))
print(yate.start_form('judge_result.py'))
# =================在页面上记录上之前的设置参数=================
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in OperatorList:
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('ExpNum', ExpNum))
print(yate.input_hidden('WrongNum', WrongNum))
print(yate.input_hidden('WrongTag', WrongTag))
print(yate.input_hidden('CorrectNum', CorrectNum))
print(yate.input_hidden('NewSetting', 0))
print(yate.input_hidden('ArithmeticExpress', ArithmeticExpress))
print(yate.input_hidden('FactResult', str(FactResult)))
#==============================记录完毕================================

print(yate.header('%s' % (ArithmeticExpress + ' = &nbsp;&nbsp;' + yate.create_inputs('CalResult', style='input_control')), 2))
Пример #34
0
#!/usr/bin/python3

import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
atheletes = athletemodel.put_to_store(data_files)

print(yate.start_response())

print(yate.include_header("Coach Kelly's List of Atheletes"))

print(yate.start_form("/cgi-bin/generate_timing_data.py"))
print(yate.para("Select an athelete from this list to work with:"))
for each in atheletes:
    print(yate.radio_button("which_athelete", atheletes[each].name))

print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Пример #35
0
            ExamNum)]['ExamCount'] = int(
                form_data['ExamCount'].value)  #保存测验题目数
        ExamRecJson['ExamRecords'][data_string][str(ExamNum)]['ExamTime'] = (
            ExamTimeInitSeconds, ExamTimeActSeconds)  #保存考试规定用时和实际用时
        ExamRecJson['AwardCount'] = AwardCount  #保存奖励数量
        record_string = json.dumps(ExamRecJson)
        ExamRecFile.write(record_string)

else:
    print(
        yate.header(
            '本次考试出问题啦,请点击&nbsp;' + yate.a_link('/index.html', '返回首页') +
            '&nbsp;重新生成试题', 1))

# =================== 下面是将算术题参数回传 ===================
print(yate.start_form('exam.py', 'name'))
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in [x.value for x in form_data['operator']]:
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('NewSetting', form_data['NewSetting'].value))
#下面是将错题传到表单里
WrongQuestionJson = {}
if (WrongExpList):
    for AwrongQuestion in WrongExpList:
        WrongQuestionJson[AwrongQuestion.ExpNum] = (
            AwrongQuestion.ArithmeticExpress, AwrongQuestion.FactResult, 0
        )  #{题号:(表达式,正确答案, 错误标记)} --错误标记:错题修订成功后,该标记变成1
    print(yate.input_hidden('WrongQuestions'))  #把错题数据做为一个JSON格式字符串传到表单
    print(
        '<script>var jsonString = JSON.stringify(%s); document.name.WrongQuestions.value=jsonString;</script>'
import athletemodel
import yate  # 模板
import time
import glob  # 可以操作系统查询一个文件名列表
import json
import requests
# 启用python的cgi跟踪技术
import cgitb

cgitb.enable()

print(yate.start_response())
print(yate.include_header("List of Athletes"))
print(yate.start_form("json_back_timing_data.py"))
print(yate.para("Select an athlete from the list"))
url = "http://127.0.0.1:8089/cgi-bin/json_back_names.py"
namesID = json.loads(requests.get(url, timeout=4).text)
# print(namesID[0])
try:
    time.sleep(1)  # 单线程,需要等namelist的结果返回后,才能进行下一个web请求,但是还不能解决,头大???
    for each_athlete in namesID:
        print(
            yate.radio_button_id('which_athlete', each_athlete[0],
                                 each_athlete[1]))
except Exception as err:
    print(err)
print(yate.end_form('Select'))
print(yate.include_footer({"Home": "/index.html"}))
Пример #37
0
                '}}'\
# ====================== 以下为奖励查询页面 =====================

print(yate.start_response())
print(yate.include_header_js('奖励查询和兑换', js_string))

# ====================== 碎片能够兑换成奖励值 =====================
if (AwardCount[1] >= 10):
    print(
        yate.header(
            '<span style="color:#ff6666">你现在有 %d 个碎片可以先兑换成奖励值啦!</span>' %
            AwardCount[1], 2))
    print(
        '<div><span style="color:#660066;font-size:18px;">请选择需要兑换的奖励值数量</span>'
    )
    print(yate.start_form('AwardTable.py', 'formname'))
    print(
        yate.subbutton('-',
                       'subone(%d,%d)' % (0, AwardCount[1]),
                       'substract',
                       status='disabled',
                       style='buttonCS'))
    print(
        '<input type="text" name="ExChange" value="0" onchange="ExCase(%d,%d)" class="input_control">'
        % (0, AwardCount[1]))
    print(
        yate.subbutton('+',
                       'addone(%d,%d)' % (0, AwardCount[1]),
                       'add',
                       style='buttonCS'))
    print(
Пример #38
0
#### get expanded word from SQL or on the air if data in not in sql, render them and pass through input method to controller 3

if sql_webModel.checkIfdataIsStore(term_ascii.decode("utf-8"), FILE_SQLITE):
    logger.info('get the expanded query from SQLite')
    lexpandedQueries_SQL = sql_webModel.get_expannedQueryFromStore(
        term_ascii.decode('utf-8'), FILE_SQLITE)

    #print ("<h1>" +  str(lexpandedQueries_SQL) + "<h1>")
    lexpandedQueries_SQL_ascii = [
        s.encode("utf-8") for s in lexpandedQueries_SQL
    ]
    ### render expanded word results ####
    print('<h2>' + "these are the expanded queries from eHownet" + '</h2>')
    print('</br>')
    print(yate.u_list(lexpandedQueries_SQL_ascii))
    print(yate.start_form(NEXT_URL, form_type="POST"))
    for each_query in lexpandedQueries_SQL:
        print(
            yate.hidden_input('expanded_terms_array',
                              each_query.encode("utf-8")))
    print(yate.end_form())
    print('</br>')
    print(yate.include_footer({"Cancel, go back to Google": "/index.html"}))
    #print(yate.include_menu1({"cancel, go back to Google": "/index.html"}, str(term_ascii) ))

else:  ## not processed before, do expannedQuery on the air
    logger.info('get the expanded query from eHownet DB')
    print('<h1>' + 'get the expanded query from eHownet DB' + '</h1>')
    print('<h2>' + 'sorry, your term is not supported in ehowent cache!' +
          '</h2>')
    logger.info('get the expanded query from eHownet DB')
Пример #39
0
# operatelist['add'] = '+'
# operatelist['subtract'] = '-'
# operatelist['multiply'] = '*'
# operatelist['divide'] = '//'
# # ================== 初始化完毕 ==================
# operatelist = ['+', '-', '*', '//']
operatelist1 = {'加号': '+', '减号': '-', '乘号': '*', '除号': '//'}
operatelist = {}
for key in operatelist1:
    operatelist[operatelist1[key]] = key

print(yate.start_response())
print(yate.include_header('这是一个WEB应用测试页面'))

print(yate.header('%s' % ('=' * 10 + '下面是测试内容' + '=' * 10), 3))
print(yate.start_form('test_content.py'))

# for Anoperator in operatelist:
#     print(yate.checked_box('operator',Anoperator))

print(yate.select_set('operator', operatelist, 3, multiple=True))

print(yate.end_form('提交'))

footer_string = '=' * 10 + '结束' + '=' * 10

form_data = cgi.FieldStorage()
if (form_data):
    if (isinstance(form_data['operator'], list)):
        OperatorList = [x.value for x in form_data['operator']]
    else:
Пример #40
0
# -*- coding: utf-8 -*-
# 生成游戏页面
import sys
import yate, arithmetic_training_games

# =================生成一个HTML页面=================
print(yate.start_response())
print(yate.include_header('欢迎来到韦浩宇的算术运算训练营!'))
# print(yate.start_form('arithmetic_training_games.py'))
print(yate.para('即将开始算术训练!', fontsize=15, fontcolor='#a52a2a'))
print(yate.start_form(''))
Numlist = [x for x in range(20)]
ArtInstance = arithmetic_training_games.ArithmeticMode(Numlist,
                                                       level=2,
                                                       OperatorList=['-'])

while (True):
    AnExpress = ArtInstance.get_ArtExpress()
    if (0 <= eval(AnExpress) <= 100):
        break
print(
    yate.header('%s = %s' % (AnExpress, yate.text_inputs('ArithmeticValue') +
                             yate.submit_button('确定')),
                header_level=1))
# print()
print(yate.end_form())

print(yate.header('更多算题,敬请期待!'))

# print('%s = ' %(AnExpress))
Пример #41
0
#! /usr/local/bin/python3

import athletemodel
import yate

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("The NUAC's List of Athletes"))
print(yate.start_form("generate_list.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in sorted(athletes):
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             each_athlete[1]))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Пример #42
0
try:
    AwardCount = [int(x.value) for x in form_data['AwardCount']]
except KeyError:
    AwardCount = [0, 0]
except json.JSONDecodeError:
    AwardCount = []

#==================== 定义一个把json字符串转换为json对象的js ====================
JS_string = ''
#==================== 输出错题页面 ====================
print(yate.start_response())
print(yate.include_header_js('欢迎来到韦浩宇的算术运算训练营!', JS_string))
print(
    yate.header(
        '<span style="color:#ff6666">下面是你本次测验的全部错题,赶紧进行更正吧,会有奖励哦!</span>', 2))
print(yate.start_form('WrongCorrect.py', 'formname'))

# 循环输出所有错题,已经修订正确的错题则不再显示输入框
for Astring in ShowWrongQuestions:
    print(yate.header(Astring, 2))

if (WQLeftTag == 1):
    # =====================更正后仍有错题,需要设置回传表单的内容=====================
    print(yate.input_hidden('WrongQuestions'))  #把所有错题传回表单
    print(
        '<script>var jsonString = JSON.stringify(%s); document.formname.WrongQuestions.value=jsonString;</script>'
        % json.dumps(WrongQuestionList))  # 将json对象转换为JSON字符串
    print(yate.end_form('确定', 'sub'))
elif (WQLeftTag == 2):
    print('</form>')
else:
Пример #43
0
#! /usr/bin/env python3

import glob

import athletemodel
import yate

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
print(yate.include_header("Aprori Page for " + str(term_ascii)))


#### get expanded word from SQL or on the air if data in not in sql, render them and pass through input method to controller 3  

if sql_webModel.checkIfdataIsStore(term_ascii.decode("utf-8"),FILE_SQLITE): 
	logger.info('get the expanded query from SQLite')
	lexpandedQueries_SQL =  sql_webModel.get_expannedQueryFromStore(term_ascii.decode('utf-8'),FILE_SQLITE)
	
	#print ("<h1>" +  str(lexpandedQueries_SQL) + "<h1>")
	lexpandedQueries_SQL_ascii = [s.encode("utf-8") for s in lexpandedQueries_SQL] 
	### render expanded word results #### 
	print('<h2>' + "these are the expanded queries from eHownet" +'</h2>')
	print ('</br>')
	print(yate.u_list(lexpandedQueries_SQL_ascii))
	print(yate.start_form(NEXT_URL, form_type="POST"))
	for each_query in lexpandedQueries_SQL:
		print(yate.hidden_input('expanded_terms_array', each_query.encode("utf-8")))
	print(yate.end_form())
	print ('</br>')
	print(yate.include_footer({"Cancel, go back to Google": "/index.html"}))
	#print(yate.include_menu1({"cancel, go back to Google": "/index.html"}, str(term_ascii) ))

else: ## not processed before, do expannedQuery on the air 
	logger.info('get the expanded query from eHownet DB')
	print('<h1>' + 'get the expanded query from eHownet DB' +'</h1>')
	print('<h2>' + 'sorry, your term is not supported in ehowent cache!' +'</h2>')
	logger.info('get the expanded query from eHownet DB')
	'''
	#lexpandedQueries_ehownet = ehownet.get_allExpannedQueryFromStore(term_ascii_ascii.decode('utf-8'))
	##TODO: do expannedQuery on the air
Пример #45
0

print(dir())

the_files = ['sarah2.txt', 'james2.txt', 'mikey2.txt', 'julie2.txt']
data = put_to_store(the_files)
print(data)

for each_athlete in data:
	print(data[each_athlete].name + ' ' + data[each_athlete].dob)

data_copy = get_from_store()
for each_athlete in data_copy:
	print(data_copy[each_athlete].name + ' ' + data_copy[each_athlete].dob)

print(yate.start_response())
print(yate.start_response("text/plain"))
print(yate.start_response("application/json"))
print(yate.include_header("Welcome to my home on the web!"))
print(yate.include_footer({'Home': '/index.html', 'Select': '/cgi-bin/select.py'}))
print(yate.include_footer({}))
print(yate.start_form("/cgi-bin/process-athlete.py"))
print(yate.end_form())
print(yate.end_form("Click to Confirm Your Order"))
for fab in ['John', 'Paul', 'George', 'Ringo']:
	print(yate.radio_button(fab, fab))
print(yate.u_list(['Life of Brian', 'Holy Grail']))
print(yate.header("Welcome to my home on the web"))
print(yate.header("This isa sub-sub-sub-sub-heading", 5))
print(yate.para("Was it worth the wait? We hope it was..."))
Пример #46
0
def main():
    form_data = cgi.FieldStorage()
    
    print(yate.start_response())
    print(yate.include_header('Estatísticas para Loterias do Brasil'))
    
    if not form_data:
        print(yate.start_form('', 'jogos.py'))
        print(yate.drop_box('Jogo: ', 'Jogos', {'Quina':'Quina',
            'Mega-Sena': 'Mega-Sena',
            'LotoFácil':'LotoFácil'}, 'Mega-Sena'))
    
        print(yate.drop_box('Estatística: ', 'Estat', {
            'doze': 'Dezenas Mais Sorteadas',
            'rule': 'Distribuição entre Pares e Impares',
            'wors': 'Maior tempo sem ser sorteado',
            'more': 'Mais Sorteado',
            'aver': 'Média de tempo sem ser sorteado',
            'sugs': 'Sugere números com melhor Escore Z',
            'sugl': 'Sugere números menos sorteados recentemente',
            'sugm': 'Sugere números sorteados recentemente',
            'last': 'Última vez sorteado',
            'unit': 'Unidades Mais Sorteadas'},
            'more'))
    
        print(yate.end_form('Enviar'))
    
    elif form_data.getvalue('Jogos') and form_data.getvalue('Estat'):
        jogo = form_data.getvalue('Jogos')
        estat = form_data.getvalue('Estat')
        if jogo == 'Quina':
            obj = QuinaStats('../data/D_QUINA.HTM')
        elif jogo == 'Mega-Sena':
            obj = SenaStats('../data/d_megasc.htm')
        elif jogo == 'LotoFácil':
            obj = LotoFacilStats('../data/D_LOTFAC.HTM')
        else:
            print(yate.para('Opção Inexistente'))
            print(yate.include_footer('&copy LotoEstat 2012'))
            return
    
        if form_data.getvalue('Estat') == 'more':
            print(yate.header('Números Mais Sorteados'))
            print(yate.para('Lista decrescente dos números mais sorteados da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('More', for_print=False)
            print(yate.start_tb(['Dezena ', ' Número de Vezes Sorteado']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'rule':
            print(yate.header('Distribuição entre Pares e Impares'))
            print(yate.para('Combinação de pares e ímpares entre os números da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_rule_even_by_odd(for_print=False) 
            print(yate.start_tb(['Dezenas Pares ', ' Dezenas Ímpares ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                even, odd = p.findall(each[0])
                print(yate.inner_tb([even, odd, each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'unit':
            print(yate.header('Unidades Mais Sorteadas'))
            print(yate.para('Lista das Unidades mais Sorteadas dos Jogos da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_more_often_unit(for_print=False) 
            print(yate.start_tb(['Dezenas terminadas em ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                unidade = p.findall(each[0])
                print(yate.inner_tb([unidade[0], each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'doze':
            print(yate.header('Dezenas Mais Sorteadas'))
            print(yate.para('Lista das Dezenas mais Sorteadas dos Jogos da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_more_often_dozen(for_print=False) 
            print(yate.start_tb(['Dezenas Começadas por ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                dezena = p.findall(each[0])
                print(yate.inner_tb([dezena[0], each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'last':
            print(yate.header('Última vez Sorteado'))
            print(yate.para('A quanto tempo a dezena não é sorteada entre os números premiados da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Last', for_print=False)
            print(yate.start_tb(['Dezena ', ' Tempo sem ser sorteada']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'wors':
            print(yate.header('Maior tempo sem ser sorteado'))
            print(yate.para('Pior tempo de espera que um número aguardou para ser sorteado entre todos os sorteios da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Worst', for_print=False)
            print(yate.start_tb(['Dezena ', ' Pior tempo sem ser sorteada']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'aver':
            print(yate.header('Média de tempo sem ser sorteado'))
            print(yate.para('Tempo médio que um número leva até ser sorteado, obtidos à partir do histórico de resultados  da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Average', for_print=False)
            print(yate.start_tb(['Dezena ', ' Média de espera entre dois sorteios']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugm':
            print(yate.header('Sugere números sorteados recentemente'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta as estatísticas individuais, favorecendo os números que saíram com mais frequencia e que foram sorteados recentemente.'))
            to_print = obj.suggest_num(method='Most Recently', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15 
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15 

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugl':
            print(yate.header('Sugere números menos sorteados recentemente'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta as estatísticas individuais, favorecendo os números que saíram com mais frequencia e que estão a mais tempo sem serem sorteados.'))
            to_print = obj.suggest_num(method='Least Recently', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugs':
            print(yate.header('Sugere números com melhor escore padrão'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta o escore padrão de cada um, favorecendo os números com menor desvio padrão da média de tempo de espera para um número ser sorteado.'))
            to_print = obj.suggest_num(method='Score', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        print(yate.header('Atualizado em : %s', header_level=6) % obj.print_updated_data())

    else :
        print(yate.para('Opção por Jogo ou Estatística não efetuada.'))
    
    print(yate.include_footer('&copy LotoEstat 2012'))