feat: 新增活動報名頁面
This commit is contained in:
parent
ecd84ccdfe
commit
0c9034d05e
@ -3,6 +3,24 @@ from config import CONFIG
|
|||||||
from tkinter import *
|
from tkinter import *
|
||||||
from tkhtmlview import HTMLLabel
|
from tkhtmlview import HTMLLabel
|
||||||
|
|
||||||
|
class textBox():
|
||||||
|
def __init__(self, root, key, value, Stype):
|
||||||
|
self.key = key
|
||||||
|
self.value = value
|
||||||
|
self.type = Stype
|
||||||
|
self.frame = Frame(root)
|
||||||
|
self.label = Label(self.frame, text=key)
|
||||||
|
self.entry = Entry(self.frame)
|
||||||
|
self.entry.insert(0, value)
|
||||||
|
|
||||||
|
if Stype==False:
|
||||||
|
self.entry.config(state='disabled')
|
||||||
|
|
||||||
|
def pack(self):
|
||||||
|
self.label.pack(side=LEFT)
|
||||||
|
self.entry.pack(side=RIGHT)
|
||||||
|
self.frame.pack()
|
||||||
|
|
||||||
|
|
||||||
def createRigestryWin():
|
def createRigestryWin():
|
||||||
|
|
||||||
@ -30,8 +48,9 @@ def createRigestryWin():
|
|||||||
rigestry=EventRegistry(CONFIG['moodle']['username'], CONFIG['moodle']['password'])
|
rigestry=EventRegistry(CONFIG['moodle']['username'], CONFIG['moodle']['password'])
|
||||||
tmpid=[]
|
tmpid=[]
|
||||||
tmpname=[]
|
tmpname=[]
|
||||||
|
events = rigestry.getEventsList()
|
||||||
if rigestry.status:
|
if rigestry.status:
|
||||||
for i in rigestry.getEventsList():
|
for i in events:
|
||||||
html+='''<tr> <td>活動ID:{}</td> <td>學期{}</td> <br> <td>活動報名狀態:{}</td> <br> <td>活動名稱:{}</td> <br> <td>活動開始時間: {}</td> <br> <td>報名方式:{}</td> <br> <td>時數: {}</td> <br><td>講師: {}</td> <br> <td>申請為教師之能活動: {}</td> </tr><p> '''.format(
|
html+='''<tr> <td>活動ID:{}</td> <td>學期{}</td> <br> <td>活動報名狀態:{}</td> <br> <td>活動名稱:{}</td> <br> <td>活動開始時間: {}</td> <br> <td>報名方式:{}</td> <br> <td>時數: {}</td> <br><td>講師: {}</td> <br> <td>申請為教師之能活動: {}</td> </tr><p> '''.format(
|
||||||
i.get("id"),i.get("semester"),i.get("status"),i.get("name"),i.get("time"),i.get("method"),i.get("hour"),i.get("speaker"),i.get("teacherEvevt") )
|
i.get("id"),i.get("semester"),i.get("status"),i.get("name"),i.get("time"),i.get("method"),i.get("hour"),i.get("speaker"),i.get("teacherEvevt") )
|
||||||
tmpid.append(i.get("id"))
|
tmpid.append(i.get("id"))
|
||||||
@ -40,19 +59,45 @@ def createRigestryWin():
|
|||||||
else:
|
else:
|
||||||
print("NO")
|
print("NO")
|
||||||
|
|
||||||
def signUp(id):
|
def signUpWin(event):
|
||||||
win=Tk()
|
win=Tk()
|
||||||
rigestry.signUpPrepare(id)
|
data = rigestry.signUpPrepare(event.get('id'))
|
||||||
|
|
||||||
|
idBox = textBox(win, "學號:", data['x_applicantID'], False)
|
||||||
|
idBox.pack()
|
||||||
|
|
||||||
|
nameBox = textBox(win, "姓名:", data['x_applicantName'], False)
|
||||||
|
nameBox.pack()
|
||||||
|
|
||||||
|
departmentBox = textBox(win, "科系:", data['x_applicantUabbrname'], False)
|
||||||
|
departmentBox.pack()
|
||||||
|
|
||||||
|
authBox = textBox(win, "身份:", data['x_applicantTitle'], False)
|
||||||
|
authBox.pack()
|
||||||
|
|
||||||
|
iphoneBox = textBox(win, "分機:", data['x_iphone'], True)
|
||||||
|
iphoneBox.pack()
|
||||||
|
|
||||||
|
phoneBox = textBox(win, "電話:", data['x_phone'], True)
|
||||||
|
phoneBox.pack()
|
||||||
|
|
||||||
|
mailBox = textBox(win, "mail:", data['x_zemail'], True)
|
||||||
|
mailBox.pack()
|
||||||
|
|
||||||
|
markBox = textBox(win, "備註:", data['x_remark'], True)
|
||||||
|
markBox.pack()
|
||||||
|
|
||||||
|
submit = Button(win, text="報名")
|
||||||
|
submit.pack()
|
||||||
|
|
||||||
win.mainloop()
|
win.mainloop()
|
||||||
|
|
||||||
|
|
||||||
for i in range(len(tmpname)):
|
for i in events:
|
||||||
Button(frame2,text="我要報名 {}".format(tmpname[i]),command=lambda:signUp(tmpid[i]) ).pack(anchor="w")
|
if i.get('status') == "B, 開放公告":
|
||||||
|
Button(frame2,text="我要報名 {}".format(i.get('name')),command=lambda:signUpWin(i) ).pack(anchor="w")
|
||||||
|
|
||||||
root.update()
|
root.update()
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
createRigestryWin()
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user