the user can quit the application any time by entering "quit"
ctrl+c and ctrl+d are now handled
This commit is contained in:
parent
35dae7b23b
commit
f704297c14
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = qrzlogger
|
name = qrzlogger
|
||||||
version = 0.6.2
|
version = 0.6.5
|
||||||
author = Michael Clemens
|
author = Michael Clemens
|
||||||
author_email = qrzlogger@qrz.is
|
author_email = qrzlogger@qrz.is
|
||||||
description = A python application to log QSOs directly to QRZ.com from the command line
|
description = A python application to log QSOs directly to QRZ.com from the command line
|
||||||
|
|
|
@ -39,7 +39,7 @@ class QRZLogger():
|
||||||
# initialize things
|
# initialize things
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.version = "0.6.2"
|
self.version = "0.6.5"
|
||||||
|
|
||||||
# Define the configuration object
|
# Define the configuration object
|
||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
|
@ -435,6 +435,8 @@ class QRZLogger():
|
||||||
# If not, we keep the data provided by the user
|
# If not, we keep the data provided by the user
|
||||||
if inp == "c":
|
if inp == "c":
|
||||||
return None
|
return None
|
||||||
|
if inp == "quit":
|
||||||
|
sys.exit()
|
||||||
if inp != "":
|
if inp != "":
|
||||||
questions[q][1] = inp
|
questions[q][1] = inp
|
||||||
# check if we are asking for the band
|
# check if we are asking for the band
|
||||||
|
@ -455,11 +457,13 @@ class QRZLogger():
|
||||||
# returns False in "n"
|
# returns False in "n"
|
||||||
def askUser(self, question):
|
def askUser(self, question):
|
||||||
while True:
|
while True:
|
||||||
inp = input("\n" + self.inputcol + question + " [" + self.defvalcol + "y/n" + self.inputcol + "]: " + style.RESET)
|
inp = input("\n" + self.inputcol + question + " [" + self.defvalcol + "y/n/quit" + self.inputcol + "]: " + style.RESET)
|
||||||
if inp == "y":
|
if inp == "y":
|
||||||
return True
|
return True
|
||||||
elif inp == "n":
|
elif inp == "n":
|
||||||
return False
|
return False
|
||||||
|
elif inp == "quit":
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -478,11 +482,14 @@ def main():
|
||||||
|
|
||||||
# Begin the main loop
|
# Begin the main loop
|
||||||
while keeponlogging:
|
while keeponlogging:
|
||||||
|
try:
|
||||||
# get a session after logging into QRZ with user/pass
|
# get a session after logging into QRZ with user/pass
|
||||||
session_key = q.get_session()
|
session_key = q.get_session()
|
||||||
# query a call sign from the user
|
# query a call sign from the user
|
||||||
resume = True
|
resume = True
|
||||||
call = input("\n\n%sEnter Callsign:%s " % (q.inputcol, style.RESET))
|
call = input("\n\n%sEnter Callsign:%s " % (q.inputcol, style.RESET))
|
||||||
|
if call == "quit":
|
||||||
|
sys.exit()
|
||||||
# check if it has the format of a valid call sign
|
# check if it has the format of a valid call sign
|
||||||
# (at least 3 characters, only alphanumeric and slashes)
|
# (at least 3 characters, only alphanumeric and slashes)
|
||||||
if not (len(call) > 2 and call.replace("/", "").isalnum()):
|
if not (len(call) > 2 and call.replace("/", "").isalnum()):
|
||||||
|
@ -559,11 +566,11 @@ def main():
|
||||||
# the user has entered 'c' during the QSO detail entering process
|
# the user has entered 'c' during the QSO detail entering process
|
||||||
else:
|
else:
|
||||||
resume = False
|
resume = False
|
||||||
|
except:
|
||||||
print(q.inputcol)
|
print("\n\n73!\n")
|
||||||
print("73!")
|
sys.exit()
|
||||||
print(style.RESET)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue