From 0c9034d05eff2b76ef09c70252cb72b8b0ff62c8 Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Sat, 3 Jul 2021 21:01:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B4=BB=E5=8B=95?= =?UTF-8?q?=E5=A0=B1=E5=90=8D=E9=A0=81=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rigestryWin.py | 59 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/rigestryWin.py b/rigestryWin.py index 970312c..29cbf94 100644 --- a/rigestryWin.py +++ b/rigestryWin.py @@ -3,6 +3,24 @@ from config import CONFIG from tkinter import * 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(): @@ -30,8 +48,9 @@ def createRigestryWin(): rigestry=EventRegistry(CONFIG['moodle']['username'], CONFIG['moodle']['password']) tmpid=[] tmpname=[] + events = rigestry.getEventsList() if rigestry.status: - for i in rigestry.getEventsList(): + for i in events: html+=''' 活動ID:{} 學期{}
活動報名狀態:{}
活動名稱:{}
活動開始時間: {}
報名方式:{}
時數: {}
講師: {}
申請為教師之能活動: {}

'''.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") ) tmpid.append(i.get("id")) @@ -40,19 +59,45 @@ def createRigestryWin(): else: print("NO") - def signUp(id): + def signUpWin(event): 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() - for i in range(len(tmpname)): - Button(frame2,text="我要報名 {}".format(tmpname[i]),command=lambda:signUp(tmpid[i]) ).pack(anchor="w") + for i in events: + if i.get('status') == "B, 開放公告": + Button(frame2,text="我要報名 {}".format(i.get('name')),command=lambda:signUpWin(i) ).pack(anchor="w") root.update() root.mainloop() -createRigestryWin() -