Skip to content

Commit 7bb37b4

Browse files
committed
VER 1.1.5 LTS
-- Add Error. : Errno 3. ^@ Change Issues Checker Env. : Windows to Linux. *? Modified Wiki.
1 parent a755e0c commit 7bb37b4

File tree

7 files changed

+74
-22
lines changed

7 files changed

+74
-22
lines changed

.github/workflows/checkiss.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
types: [opened, reopened]
88
jobs:
99
build:
10-
runs-on: windows-latest
10+
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
1313
- name: Check issue actor

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ This change log supports two languages: `en-Us` `zh-Hans`. (**Every two lines, t
88

99
这个更新日志支持两个语言:`en-Us` `zh-Hans`。(**每两行第一行为 `en-Us` 第二行为 `zh-Hans`**
1010

11+
## 1.1.5.x LTS
12+
13+
**This version of the program is long term supported.**
14+
15+
**此版本的程序被长期支持。**
16+
17+
Change Issues Checker Action runtime environment.
18+
19+
更改 Issues Checker Action 运行时环境。
20+
21+
Fix ISS #5. (Modify number range & The font size varies with the length of the number)
22+
23+
修复 ISS #5。(修改数字范围 & 字号随数字长度变化)
24+
25+
Add exception handling.
26+
27+
加入异常处理。
28+
1129
## 1.1.4.x LTS
1230

1331
**This version of the program is long term supported.**

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Yuchen Ren
3+
Copyright (c) 2022 Class Tools Develop Team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

RandomRollCall.py

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,36 @@
1010
root = tk.Tk()
1111
supported_lang = ["en-Us", "zh-Hans"]
1212

13+
# Error
14+
def errno_1():
15+
showerror(title = "Error", message = "[Errno 1] Cannot read settings file data.")
16+
print("ERROR: [Errno 1] Cannot read settings file data.")
17+
18+
def errno_2():
19+
showerror(title = "Error", message = "[Errno 2] Cannot read language file data.")
20+
print("ERROR: [Errno 2] Cannot read language file data.")
21+
22+
def errno_3():
23+
showerror(title = "Error", message = "[Errno 3] Number out of range. (0 < min or max < 100000 and min < max)")
24+
print("ERROR: [Errno 3] Number out of range. (0 < min or max < 100000 and min < max)")
25+
1326
# Yaml + Language
14-
curPath = os.path.dirname(os.path.realpath(__file__))
15-
yamlSettingsPath = os.path.join(curPath, "settings.yml")
27+
yamlSettingsPath = os.path.join("", "settings.yml")
1628
try:
1729
SettingsFile = open(yamlSettingsPath, 'r', encoding = 'utf-8')
1830
dicSettings = yaml.load(SettingsFile.read(), Loader = yaml.FullLoader)
1931
default_Lang = dicSettings['Language']
2032
minnum = dicSettings['Min']
2133
maxnum = dicSettings['Max']
34+
if minnum == None or maxnum == None:
35+
raise TypeError
2236
version = dicSettings['Version']
2337
SettingsFile.close()
2438
except:
25-
showerror(title = "Error", message = "[Errno 1] Cannot read settings file data.")
26-
print("ERROR: [Errno 1] Cannot read settings file data.")
39+
errno_1()
2740
root.quit()
2841
try:
29-
yamlPath = os.path.join(curPath, "lang/" + default_Lang + ".yml")
42+
yamlPath = os.path.join("", "lang/" + default_Lang + ".yml")
3043
file = open(yamlPath, 'r', encoding = 'utf-8')
3144
dic = yaml.load(file.read(), Loader = yaml.FullLoader)
3245
Lang_Title = dic['Title']
@@ -45,8 +58,7 @@
4558
Lang_Switch_Error_Message = dic['Switch_Lang_Error']
4659
file.close()
4760
except:
48-
showerror(title = "Error", message = "[Errno 2] Cannot read language file data.")
49-
print("ERROR: [Errno 2] Cannot read language file data.")
61+
errno_2()
5062
root.quit()
5163

5264
# Update Settings
@@ -55,17 +67,42 @@ def update():
5567
data = {"Language" : default_Lang, "Min" : minnum, "Max" : maxnum, "Version" : version}
5668
yaml.dump(data = data, stream = SettingsFile, allow_unicode = True, sort_keys = False)
5769

58-
# Min and MAX
70+
# Min Max Frontsize
5971
def Ask_MIN():
6072
global minnum
61-
minnum = askinteger(title = Lang_Menu_MIN, prompt = Lang_Menu_MIN)
73+
tmp = askinteger(title = Lang_Menu_MIN, prompt = Lang_Menu_MIN)
74+
if tmp <= 0 or tmp >= maxnum:
75+
errno_3()
76+
return
77+
if tmp != None:
78+
minnum = tmp
79+
else:
80+
return
6281
update()
6382

6483
def Ask_MAX():
6584
global maxnum
66-
maxnum = askinteger(title = Lang_Menu_MAX, prompt = Lang_Menu_MAX)
85+
tmp = askinteger(title = Lang_Menu_MAX, prompt = Lang_Menu_MAX)
86+
if tmp >= 100000 or tmp <= minnum:
87+
errno_3()
88+
return
89+
if tmp != None:
90+
maxnum = tmp
91+
else:
92+
return
6793
update()
6894

95+
def FrontSize(tmp):
96+
length = len(str(tmp))
97+
if length <= 3:
98+
return 200
99+
elif length == 4:
100+
return 150
101+
elif length == 5:
102+
return 100
103+
else:
104+
return 50
105+
69106
# Menubar
70107
def Show_Help():
71108
if default_Lang == "zh-Hans":
@@ -103,19 +140,16 @@ def Ask_Lang():
103140
root.geometry("400x400")
104141
root.resizable(width = False, height = False)
105142

106-
# Random
107-
def optimize(Min, Max):
108-
return random.randint(Min, Max)
109-
110143
# Mainloop
111144
def label_click_handler(events):
112-
selected = optimize(minnum, maxnum)
145+
selected = random.randint(minnum, maxnum)
146+
label_obj1.config(font = 'Helvetica -%d bold' % FrontSize(selected))
113147
label_obj1['text'] = selected
114148

115149
# Show
116-
selected = optimize(minnum, maxnum)
150+
selected = random.randint(minnum, maxnum)
117151
label_obj1 = tk.Label(root, text = selected, width = 380, height = 380)
118-
label_obj1.config(font = 'Helvetica -%d bold' % 200)
152+
label_obj1.config(font = 'Helvetica -%d bold' % FrontSize(selected))
119153
label_obj1.bind("<Button-1>", label_click_handler)
120154
label_obj1.pack(side = tk.LEFT)
121155
root.mainloop()

lang/en-Us.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ Ask_Min_Message: "Edit minimum student number..."
99
Ask_Max_Message: "Edit maximum student number..."
1010
Switch_Lang: "Switch language..."
1111
Switch_Info: "Please enter the language code you need to switch to, it currently supports zh-Hans en-Us."
12-
About_Message: "This program uses MIT License, Developer: Yuchen Ren.\nGithub Repo: https://github.com/ren-yc/RandomRollCall\nVersion "
12+
About_Message: "This program uses MIT License, Developer: Class Tools Develop Team.\nGithub Repo: https://github.com/class-tools/RandomRollCall\nVersion "
1313
Error: "Error"
1414
Switch_Lang_Error: "Unsupported language."

lang/zh-Hans.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ Ask_Min_Message: "编辑最小学号..."
99
Ask_Max_Message: "编辑最大学号..."
1010
Switch_Lang: "更改语言..."
1111
Switch_Info: "请输入你想要切换至的语言代号,目前支持 zh-Hans en-Us。"
12-
About_Message: "本程序使用 MIT 协议,开发者 Yuchen Ren\nGithub 存储库:https://github.com/ren-yc/RandomRollCall\n版本 "
12+
About_Message: "本程序使用 MIT 协议,开发者 Class Tools Develop Team\nGithub 存储库:https://github.com/class-tools/RandomRollCall\n版本 "
1313
Error: "错误"
1414
Switch_Lang_Error: "不支持的语言。"

settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Language: zh-Hans
22
Min: 1
33
Max: 49
4-
Version: 1.1.4
4+
Version: 1.1.5

0 commit comments

Comments
 (0)