diff --git a/src/main/Main.py b/src/main/Main.py index a42233c..6c14654 100644 --- a/src/main/Main.py +++ b/src/main/Main.py @@ -1,5 +1,6 @@ # Author: RYCB studio # -*- coding:utf-8 -*- +# Version 1.5.2-a # MIT License @@ -31,28 +32,60 @@ import configparser from fuzzywuzzy import fuzz -import sys +import urllib.request as ur import easygui as eg import datetime +import webbrowser as wb dt = datetime.datetime.now() cfps = configparser.ConfigParser() +def checkForUpdates(serverName): + cfps.read("update\\update.ucf") + ur.urlretrieve("{}/latestVersion".format(serverName), "version") + humanReadableVersion = cfps.get("Version", "version") + machineReadableVersion = cfps.get("programSelfCheck", "version") + with open("update\\version", "r") as v: + v = v.readline().strip() + if humanReadableVersion == v or machineReadableVersion == v: + eg.msgbox("Congratulations! Your program version is the latest version!\n恭喜!您的程序版本是最新版本!") + else: + cc = eg.choicebox( + "Oops! Your program version is not the latest version. You have two options:\n抱歉!您的程序版本不是最新版,您有两种选择:", + "qyf-rycbstudio.github.io", ["Download the latest version\t下载最新版本", "No, thanks\t不了,谢谢"]) + if cc == "Download the latest version\t下载最新版本": + cc1 = eg.choicebox("You have two options:", + "qyf-rycbstudio.github.io", + ["Let the program download the latest version\t让程序下载最新版本", "Manual Download\t手动下载"]) + if cc1 == "Let the program download the latest version\t让程序下载最新版本": + pass + else: + eg.msgbox("Please go to the website to download\n请前往网页下载") + wb.open( + "https://github.com/QYF-RYCBStudio/Aerospace-Knowledge-Learning-And-Testing-System/releases") + else: + pass + + def main(): init() - a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "退出"], image='./yy.png') + a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "检查更新", "退出"], image='.\\yy.png') while a != "退出": if a == "学习": questions() - a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "退出"], image='./yy.png') + a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "检查更新", "退出"], image='.\\yy.png') elif a == "做题": exercises() - a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "退出"], image='./yy.png') - else: - a = "学习" + a = eg.buttonbox("请选择:", "qyf-rycbstudio.github.io", ["学习", "做题", "检查更新", "退出"], image='.\\yy.png') + elif a == "检查更新": + checkForUpdates("https://raw.githubusercontent.com/QYF-RYCBStudio/Aerospace-Knowledge-Learning-And-Testing-System/main/") + main() else: - sys.exit(0) + if eg.ynbox("确定退出吗?", "qyf-rycbstudio.github.io"): + quit() + else: + main() def init(): @@ -60,7 +93,7 @@ def init(): w.write("") log("Program is Initializing...") log("Loading Module ConfigParser...") - eg.msgbox("\t\t\t 【 航天知识学习检测系统V1.5 】", "qyf-rycbstudio.github.io", ok_button="下一步", image='./yy2.png') + eg.msgbox("\t\t\t 【 航天知识学习检测系统V1.5.1】", "qyf-rycbstudio.github.io", ok_button="下一步", image='.\\yy2.png') log("The Program has been started.") @@ -77,21 +110,21 @@ def questions(): ex_content = eval(cfps['exercise']["ex_dict"]) log("Dictionaries are showing...") choices = eg.buttonbox("请选择序号学习相关知识:", "qyf-rycbstudio.github.io", - ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], image="./ques.png") - if choices != "./ques.png": + ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], image=".\\ques.png") + if choices != ".\\ques.png": try: eg.msgbox(ex_content[choices]) except: init() else: questions() - ex = eg.buttonbox("请选择: ", "qyf-rycbstudio.github.io", ["继续", "返回"], image="./ques.png") + ex = eg.buttonbox("请选择: ", "qyf-rycbstudio.github.io", ["继续", "返回"], image=".\\ques.png") # ex = eg.ccbox("请选择: ", "qyf-rycbstudio.github.io", ["继续", "返回"]) if ex == "继续": questions() log('The user had chose choice "next".') - elif ex == "./ques.png": - init() + elif ex == ".\\ques.png": + questions() else: log('The user had chose choice "exit".') main() @@ -108,7 +141,7 @@ def exercises(): log("Module ConfigParser is Loaded.") global fuzz_res choices = ["A", "B", "C"] - eg.msgbox("题目开始!", "qyf-rycbstudio.github.io", "Start!", image="./ans.png") + eg.msgbox("题目开始!", "qyf-rycbstudio.github.io", "Start!", image=".\\ans.png") log("Now choice: Normal Exercise") ex_content = eval(cfps['exercise']["ex_dict"]) answer = [] diff --git a/src/main/README.md b/src/main/README.md index d1c2e30..9317dbf 100644 --- a/src/main/README.md +++ b/src/main/README.md @@ -1,6 +1,12 @@ # [QYF-RYCBStudio.io][Link] - -参考答案:http://www.spacechina.com/n25/n148/n272/n4785/c103490/content.html +**参考答案**:*http://www.spacechina.com/n25/n148/n272/n4785/c103490/content.html* [Link]:https://qyf-rycbstudio.github.io +#   +##   +###   + + + +##### *Copyright (c) 2022 RYCBStudio, All rights reserved.* \ No newline at end of file diff --git a/src/main/exercises.cfg b/src/main/exercises.cfg index 61eee12..211bc16 100644 --- a/src/main/exercises.cfg +++ b/src/main/exercises.cfg @@ -1,7 +1,7 @@ [Users] -usermarks = 10.0 +usermarks = 0.0 [exercise] -ex_dict = {"1":"Ƴ˺\n\n\nA.ƳɴɻͿռվ3˺\n\nB.ƳUFOǺͿռվ3˺\n\nC.ƳɻͿռվ3˺","2":"˺ʲô;\n\n\nA.ɴͺɻҪڽͺԱͻ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹȡ\n\nB.ɴUFOҪڽͺԱˣ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹ\n\nC.ɻҪڽͺԱͻ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹȡ","3":"Ĺ\n\n\n\tA.ĺǡļйʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣйǻĹ硣\n\tB.ĺǡļйغʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣйǻĹ硣\n\tC.ĺǡļձϱʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣձǻĹ硣","4":"ҹۺŷɴɼնɣ\n\n\n\tA.ۺŷɴҹƵ˷ɴáһΡͣɹաزաƽպ͸Ӷιɣƽպ͹ϸһ̫ܷ塣ƽڷɴ²زм䣬ϲӶڷɴˡ\n\tB.ۺŷɴҹƵ˷ɴáնΡͣɹաزաƽպ͸ӶΡƽιɣƽպ͹ϸһ̫ܷ塣ƽڷɴ²زм䣬ϲӶڷɴˡ\n\tC.ۺŷɴҹƵ˷ɴáһһΡͣƽպ͸Ӷιɣƽһ̫ܷ塣ƽڷɴ²Ӷڷɴˡ.","5":"ۺŷɴһΡʲô\n\n\n\tA.ƽǷɴڿռмصʱĶװãزǷɴɡкͷعкԱIJնΣҲɴĿģǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣\n\tB.زǷɴڿռмصʱĶװãǷɴɡкͷعкԱIJնΣҲɴĿģƽǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣\n\tC.ǷɴڿռмصʱĶװãƽǷɴɡкͷعкԱIJնΣҲɴĿģزǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣","6":"ɴصʱвնζ\n\n\nA.ǡɴصʱֻзزһշص档زշ󣬹տڹϼҡ\n\nB.ǡɴصʱвնص档\n\nC.ѡA","7":"ĵһ˷ɴǼշɴ\n\n\n\tA.ĵһŷɴ˫շɴĵһˮǡ6ŷɴǵշɴ1962220գԱ׳ͺŷɴƵ3Ȧ\n\tB.ĵһ족ŷɴǵշɴĵһ6ŷɴ˫ղշɴ1962220գԱ׳ͺŷɴƵ3Ȧ\n\tC.ĵһ˹ŷɴ˫շɴĵڶˮǡ6ŷɴǵշɴ1962220գԱ׳ͺŷɴƵ3Ȧ","8":"ۺŷɴɶٸϵͳɣ\n\n\n\tA.13ϵͳṹƵơݹͨšȿơƽԴЧغɡϡԱDZӦ½\n\tB.10ϵͳṹƵơݹͨšȿơƽԴЧغɡ½ȡлûеġ\n\nC.ѡA","9":"ۺŷɴķزʲôӣ\n\n\n\tA.ۺŷɴزյһйŴĴӣʴͷ׶壬ڷɴвΪܱսṹϲвͨԱʹáز3ԱΡ\n\tB.ۺŷɴزյһйŴĴ󶦣ʷΣڷɴвΪܱսṹϲвͨԱʹáز3ԱΡ\n\tC.ۺŷɴزյһйŴĴӣʴͷ׶壬ڷɴвΪܱսṹϲвͨԱʹáز5ԱΡ","10":"ԱڡۡŷɴĿռܴ\n\n\n\tA.㸽ӶΣۡŷɴռ8׸ߣֱ2.5ףܹṩԱɻĿռԼ6ҡ\n\tB.㸽ӶΣۡŷɴռ10׸ߣֱ3ףܹṩԱɻĿռԼ10ҡ\n\tC.㸽ӶΣۡŷɴռ2׸ߣֱ1ףܹṩԱɻĿռԼ0.5ҡ"} +ex_dict = {"1":"Ƴ˺\n\n\nA.ƳɴɻͿռվ3˺\n\nB.ƳUFOǺͿռվ3˺\n\nC.ƳɻͿռվ3˺","2":"˺ʲô;\n\n\nA.ɴͺɻҪڽͺԱͻ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹȡ\n\nB.ɴUFOҪڽͺԱˣ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹ\n\nC.ɻҪڽͺԱͻ̫շʱһ㲻20죬ֿɳΪռվ̫ճУص棬Ҫڹ쿴ءоռѧ̫ڹȡ","3":"Ĺ\n\n\n\tA.ĺǡļйʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣйǻĹ硣\n\tB.ĺǡļйغʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣйǻĹ硣\n\tC.ĺǡļձϱʱڡҩδҴʱͰѻҩͲڼϣȼź󣬿ҩķʹɵøԶֻѾִijΡ繫ϣձǻĹ硣","4":"ҹۺŷɴɼնɣ\n\n\n\tA.ۺŷɴҹƵ˷ɴáһΡͣɹաزաƽպ͸Ӷιɣƽպ͹ϸһ̫ܷ塣ƽڷɴ²زм䣬ϲӶڷɴˡ\n\tB.ۺŷɴҹƵ˷ɴáնΡͣɹաزաƽպ͸ӶΡƽιɣƽպ͹ϸһ̫ܷ塣ƽڷɴ²زм䣬ϲӶڷɴˡ\n\tC.ۺŷɴҹƵ˷ɴáһһΡͣƽպ͸Ӷιɣƽһ̫ܷ塣ƽڷɴ²Ӷڷɴˡ.","5":"ۺŷɴһΡʲô\n\n\n\tA.ƽǷɴڿռмصʱĶװãزǷɴɡкͷعкԱIJնΣҲɴĿģǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣\n\tB.زǷɴڿռмصʱĶװãǷɴɡкͷعкԱIJնΣҲɴĿģƽǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣\n\tC.ǷɴڿռмصʱĶװãƽǷɴɡкͷعкԱIJնΣҲɴĿģزǺԱ̫йijװиʵ豸ӶҲйɶΣΪһҷɴռվԽ׼ġ˷нԽǰҲ԰װڿռ̽⡣","6":"ɴصʱвնζ\n\n\nA.ǡɴصʱֻзزһշص档زշ󣬹տڹϼҡ\n\nB.ǡɴصʱвնص档\n\nC.","7":"ĵһ˷ɴǼշɴ\n\n\n\tA.ĵһŷɴ˫շɴĵһˮǡ6ŷɴǵշɴ1962220գԱ׳ͺŷɴƵ3Ȧ\n\tB.ĵһ족ŷɴǵշɴĵһ6ŷɴ˫ղշɴ1962220գԱ׳ͺŷɴƵ3Ȧ\n\tC.ĵһ˹ŷɴ˫շɴĵڶˮǡ6ŷɴǵշɴ1962220գԱ׳ͺŷɴƵ3Ȧ","8":"ۺŷɴɶٸϵͳɣ\n\n\n\tA.13ϵͳṹƵơݹͨšȿơƽԴЧغɡϡԱDZӦ½\n\tB.10ϵͳṹƵơݹͨšȿơƽԴЧغɡ½ȡлûеġ\n\nC.","9":"ۺŷɴķزʲôӣ\n\n\n\tA.ۺŷɴزյһйŴĴӣʴͷ׶壬ڷɴвΪܱսṹϲвͨԱʹáز3ԱΡ\n\tB.ۺŷɴزյһйŴĴ󶦣ʷΣڷɴвΪܱսṹϲвͨԱʹáز3ԱΡ\n\tC.ۺŷɴزյһйŴĴӣʴͷ׶壬ڷɴвΪܱսṹϲвͨԱʹáز5ԱΡ","10":"ԱڡۡŷɴĿռܴ\n\n\n\tA.㸽ӶΣۡŷɴռ8׸ߣֱ2.5ףܹṩԱɻĿռԼ6ҡ\n\tB.㸽ӶΣۡŷɴռ10׸ߣֱ3ףܹṩԱɻĿռԼ10ҡ\n\tC.㸽ӶΣۡŷɴռ2׸ߣֱ1ףܹṩԱɻĿռԼ0.5ҡ"} ex_ans = {"1":"A","2":"A","3":"A","4":"A","5":"A","6":"A","7":"A","8":"A","9":"A","10":"A"} diff --git a/src/main/logs/RYCBStudio-Log.log b/src/main/logs/RYCBStudio-Log.log index bf996e5..9408980 100644 --- a/src/main/logs/RYCBStudio-Log.log +++ b/src/main/logs/RYCBStudio-Log.log @@ -1,3 +1,3 @@ -[Client/INFO] [2022-04-16 19:36:26] Program is Initializing... -[Client/INFO] [2022-04-16 19:36:26] Loading Module ConfigParser... -[Client/INFO] [2022-04-16 19:36:26] The Program has been started. +[Client/INFO] [2022-04-17 12:20:06] Program is Initializing... +[Client/INFO] [2022-04-17 12:20:06] Loading Module ConfigParser... +[Client/INFO] [2022-04-17 12:20:06] The Program has been started. diff --git a/src/main/update/update.ucf b/src/main/update/update.ucf new file mode 100644 index 0000000..44c2dda --- /dev/null +++ b/src/main/update/update.ucf @@ -0,0 +1,10 @@ +[Version] +version = 1.5.2-a +fullVersionName = Aerospace Knowledge Learning And Testing System 0.0.1 alpha +productName = Aerospace Knowledge Learning And Testing System +friendlyAppName = Aerospace Knowledge Learning And Testing System +internalName = com.rycb.aklts +internalVersion = aklts.version_1.5.2-a + +[programSelfCheck] +version = 1.5.2-a \ No newline at end of file