Skip to content

Commit

Permalink
Merge pull request #3 from Student-WangYL/hotfix
Browse files Browse the repository at this point in the history
	modified:   GUI.py
  • Loading branch information
RayanceKing authored Mar 7, 2024
2 parents 5293fb4 + 1172f99 commit 29fd548
Show file tree
Hide file tree
Showing 2,050 changed files with 226,220 additions and 1,096 deletions.
66 changes: 37 additions & 29 deletions GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,37 +120,45 @@ def classHandler(text):
# day: 一周中的某一天 / courses: 一天内的所有课程

for day, courses in enumerate(classmatrixT):
# time: 课程的排名 / course_cb: 表单元格中的一个项目
for course_time, course_cb in enumerate(courses):
course_list = list(filter(None, course_cb.split("/")))
for course in course_list:
id = uuid.uuid3(uuid.NAMESPACE_DNS, course + str(day)).hex
# 如果课程不为空且不在课程信息中,将其添加到课程信息中
if course != "\xa0" and (
not course_time or id not in courseInfo.keys()
):
nl = list(
filter(lambda x: course.startswith(x), classNameList))
# 待修复“C/C++无法正确解析”
assert len(nl) == 1, "无法正确解析课程名称"
classname = nl[0]
course = course.replace(classname, "").strip()
# 正则表达式匹配课程信息
res = re.match(r"(\S+)? *([单双]?) *((\d+-\d+,?)+)", course)
assert res, "课程信息解析异常"
# 将课程信息添加到课程信息中
info = {
"classname": classname,
"classtime": [course_time + 1],
"day": day + 1,
"week": list(filter(None, res.group(3).split(","))),
"oe": oeDict.get(res.group(2), 3),
"classroom": [res.group(1)],
}
courseInfo[id] = info
# 如果课程不为空且在课程信息中,将其添加到课程信息中
elif course != "\xa0" and id in courseInfo.keys():
courseInfo[id]["classtime"].append(course_time + 1)
targetlen = len(course_list)
index = 0
while index < targetlen:
course = course_list[index]
if course != "\xa0": # 检查课程是否为空
id = uuid.uuid3(uuid.NAMESPACE_DNS, course + str(day)).hex
if not course_time or id not in courseInfo.keys():
nl = list(
filter(lambda x: course.startswith(x), classNameList))
if not nl: # 如果没有匹配的课程名称
if index < targetlen - 1: # 如果不是最后一个元素
# 将当前课程和下一个课程合并,并替换下一个课程
course_list[index +
1] = f"{course}/{course_list[index + 1]}"
index += 1 # 跳过下一个元素
continue
else:
raise ValueError("无法正确解析课程名称")
# 如果找到匹配的课程名称
assert len(nl) == 1, "多个课程名称匹配,无法正确解析"
classname = nl[0]
course = course.replace(classname, "").strip()
res = re.match(
r"(\S+)? *([单双]?) *((\d+-\d+,?)+)", course)
assert res, "Course information parsing exception"
info = {
"classname": classname,
"classtime": [course_time + 1],
"day": day + 1,
"week": list(filter(None, res.group(3).split(","))),
"oe": oeDict.get(res.group(2), 3),
"classroom": [res.group(1)],
}
courseInfo[id] = info
elif id in courseInfo.keys():
courseInfo[id]["classtime"].append(course_time + 1)
index += 1

# 合并同一课程的不同上课时间
for course in courseInfo.values():
Expand Down
49 changes: 49 additions & 0 deletions GUI.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['GUI.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='GUI',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='GUI',
)
app = BUNDLE(
coll,
name='GUI.app',
icon=None,
bundle_identifier=None,
)
Loading

0 comments on commit 29fd548

Please sign in to comment.