add get out if you don't have a licence

This commit is contained in:
MeaTLoTioN 2021-11-30 16:45:01 +00:00
parent 8eb97d7add
commit 64656bf332

View File

@ -1,6 +1,6 @@
from mystic_bbs import * from mystic_bbs import *
from datetime import datetime from datetime import datetime
import os, pickle, json, calendar, time, operator, subprocess, requests import os, pickle, json, calendar, time, operator, subprocess, requests, sys
user = getuser(0) user = getuser(0)
cfg = getcfg(0) cfg = getcfg(0)
@ -14,6 +14,7 @@ db_filename = script_path+"/"+"mL-ham_logbook.dat"
db = {} db = {}
db["users"] = {} db["users"] = {}
db["logs"] = {} db["logs"] = {}
isAborted = False
## define FG colours ## define FG colours
DBLK = "|00" DBLK = "|00"
@ -346,60 +347,70 @@ def exportLogBook() :
def checkConfig(S = None) : def checkConfig(S = None) :
global db global db
global isAborted
if handle not in db["users"] :
writeln("|CLDo you have an Amateur Radio Licence and Call-sign? (Y/N)")
ch = onekey(chr(13) + 'YN', False)
if ch == 'N' :
isAborted = True
if S : if S :
if S.upper() == "RESET" : if S.upper() == "RESET" :
if handle in db["users"] : if handle in db["users"] :
del db["users"][handle] del db["users"][handle]
cStatus = "|CL|07Reconfiguring your details now."
else:
cStatus = "|CL|07You haven't yet configured your details, lets walk through them now."
if handle not in db["users"] : if not isAborted :
db["users"][handle] = {} if handle not in db["users"] :
isok = False db["users"][handle] = {}
while not isok : isok = False
writeln("|CL|07You haven't yet configured your details, lets walk through them now.") while not isok :
writeln("") writeln(cStatus)
gotoxy(1,3) writeln("")
write("What is your Amateur Radio call sign: ") gotoxy(1,3)
gotoxy(39,3) write("What is your Amateur Radio call sign: ")
callsign = getstr(2,40,45,"") gotoxy(39,3)
if callsign : callsign = getstr(2,40,45,"")
writeln("You chose |10"+callsign+"|07, is this ok? (y/n)") if callsign :
ch = onekey(chr(13) + 'YN', False) writeln("You chose |10"+callsign+"|07, is this ok? (y/n)")
if ch == 'Y' : ch = onekey(chr(13) + 'YN', False)
db["users"][handle]["callsign"] = callsign if ch == 'Y' :
isok = True db["users"][handle]["callsign"] = callsign
if ch == 'N' : isok = True
if ch == 'N' :
pass
else :
pass pass
else :
pass isok = False
while not isok :
isok = False gotoxy(1,6)
while not isok : write("What is your Full Name: ")
gotoxy(1,6) gotoxy(25,6)
write("What is your Full Name: ") # getstr(mode,width_vis,length_var,default)
gotoxy(25,6) fullname = getstr(1,40,45,"")
# getstr(mode,width_vis,length_var,default) if fullname :
fullname = getstr(1,40,45,"") writeln("You chose |10"+fullname+"|07, is this ok? (y/n)")
if fullname : ch = onekey(chr(13) + 'YN', False)
writeln("You chose |10"+fullname+"|07, is this ok? (y/n)") if ch == 'Y' :
ch = onekey(chr(13) + 'YN', False) db["users"][handle]["fullname"] = fullname
if ch == 'Y' : isok = True
db["users"][handle]["fullname"] = fullname if ch == 'N' :
isok = True pass
if ch == 'N' : else :
pass pass
else :
pass saveDB()
saveDB()
## start main program ## start main program
loadDB() loadDB()
checkConfig() checkConfig()
showTitle() if not isAborted :
showTitle()
## main loop
while canexit == "no": ## main loop
canexit = mainMenu() while canexit == "no":
canexit = mainMenu()