示例#1
0
文件: orar.py 项目: rosedu/cspay
def write_header(ws, univ, faculty, department, teacher, position):
	"""Insert the header of the table""" 
	ws.col(0).width = 6*256
	for i in range(1, 12):
		ws.col(i).width = 15*256
	dw.write(ws, 0, 0, univ)
	dw.write(ws, 0, 4, "Catedra " + department)
	dw.write(ws, 1, 0, faculty)
	dw.write(ws, 3, 2, "Orarul pentru")
	dw.write(ws, 3, 3, position + " " + teacher)
	dw.set_row_h(ws, 6, 3)
	dw.write(ws, 6, 0, "Ora", dw.boxed(2,1,1))
	
	for i in range(0,5):
		ws.write_merge(6, 6, 2*i+1, 2*i + 2, ro_days[i], dw.faktup(2))

	for i in range(0, 14):
		dw.write(ws, 7+i, 0, str(i+8)+":00", dw.boxed(1, 1, h_align = 2))
		dw.set_row_h(ws, 7 + i, 3)
示例#2
0
文件: orar.py 项目: rosedu/cspay
def insert_course(ws, i, courses):
	j = 2*i + 1
	h0 = 7
	t = 0
	loc = ()
	for curs in courses:
		a, b = curs['ore'].split("-")
		h1 = int(a) - 1
		h2 = int(b) - 1

		if h0 < h1:
			jump(ws, h0, h1, j)
	
		if t > 1:
				put_corner(ws, loc, t)
				t = 0	
		
		if curs['parit'] == 2:
			if curs['pari_st'] == 1:
				ws.write(h1, j, curs['disciplina'] + " (" + curs ['tip'] + ") \n"
                       + curs['grupa'] + " - " + curs['sala'], dw.half("up"))
				t = 1
				loc = (h1, j)
			else:
				ws.write(h2 - 1, j + 1, curs['disciplina'] + " (" + curs ['tip'] + ") \n"
                       + curs['grupa'] + " - " + curs['sala'], dw.half("down"))
				t += 2
				loc = (h1, j)
		else:
			ws.write_merge(h1, h2 - 1, j, j + 1, curs['disciplina'] + " (" + curs ['tip'] + ") \n"
                       + curs['grupa'] + " - " + curs['sala'], dw.faktup(2))
		h0 = h2
	
	if t > 1:
				put_corner(ws, loc, t)
	if h0 < 21:
		jump(ws, h0, 21, j)