tilføj batch mode
This commit is contained in:
parent
1dc57a051c
commit
7c809ac711
33
klandr.py
33
klandr.py
|
@ -49,7 +49,8 @@ def menu_main():
|
||||||
menu_klandringer()
|
menu_klandringer()
|
||||||
elif tag == "Afsluttende":
|
elif tag == "Afsluttende":
|
||||||
menu_afsluttende()
|
menu_afsluttende()
|
||||||
|
else:
|
||||||
|
quit()
|
||||||
|
|
||||||
# Begin klandringer
|
# Begin klandringer
|
||||||
|
|
||||||
|
@ -60,13 +61,16 @@ def menu_klandringer():
|
||||||
("Ændr", "Ændre en eksisterende klandring"),
|
("Ændr", "Ændre en eksisterende klandring"),
|
||||||
("Beskriv", "Beskriv en eksisterende klandring"),
|
("Beskriv", "Beskriv en eksisterende klandring"),
|
||||||
#("Omarrangér", "Omarrangere de eksisterende klandringer"),
|
#("Omarrangér", "Omarrangere de eksisterende klandringer"),
|
||||||
("Slet", "Slette en eksisterende klandring")])
|
("Slet", "Slette en eksisterende klandring"),
|
||||||
|
("Batch", "Gå i batch-mode")])
|
||||||
|
|
||||||
if code == d.CANCEL:
|
if code == d.CANCEL:
|
||||||
menu_main()
|
menu_main()
|
||||||
elif code == d.OK:
|
elif code == d.OK:
|
||||||
if tag == "Ny":
|
if tag == "Ny":
|
||||||
create_klandring()
|
create_klandring()
|
||||||
|
elif tag == "Batch":
|
||||||
|
batch_mode()
|
||||||
else:
|
else:
|
||||||
klandring = menu_select_klandring()
|
klandring = menu_select_klandring()
|
||||||
if klandring != None:
|
if klandring != None:
|
||||||
|
@ -76,8 +80,8 @@ def menu_klandringer():
|
||||||
describe_klandring(klandring)
|
describe_klandring(klandring)
|
||||||
elif tag == "Slet":
|
elif tag == "Slet":
|
||||||
delete_klandring(klandring)
|
delete_klandring(klandring)
|
||||||
else:
|
|
||||||
menu_klandringer()
|
menu_klandringer()
|
||||||
|
|
||||||
def menu_select_klandring():
|
def menu_select_klandring():
|
||||||
klandringer_entries = [(str(i),k["klandrer"] + " v. " + k["klandret"] + " - " + k["title"]) for i,k in enumerate(klandringer)]
|
klandringer_entries = [(str(i),k["klandrer"] + " v. " + k["klandret"] + " - " + k["title"]) for i,k in enumerate(klandringer)]
|
||||||
|
@ -89,7 +93,7 @@ def menu_select_klandring():
|
||||||
|
|
||||||
def create_klandring():
|
def create_klandring():
|
||||||
klandringer.append({"klandrer":"","klandret":"","title":"","description":"","taber":""})
|
klandringer.append({"klandrer":"","klandret":"","title":"","description":"","taber":""})
|
||||||
edit_klandring(-1)
|
return edit_klandring(-1)
|
||||||
|
|
||||||
|
|
||||||
def edit_klandring(strid):
|
def edit_klandring(strid):
|
||||||
|
@ -109,7 +113,8 @@ def edit_klandring(strid):
|
||||||
k["taber"] = elements[3]
|
k["taber"] = elements[3]
|
||||||
save()
|
save()
|
||||||
|
|
||||||
menu_klandringer()
|
return code
|
||||||
|
|
||||||
|
|
||||||
def describe_klandring(strid):
|
def describe_klandring(strid):
|
||||||
id = int(strid)
|
id = int(strid)
|
||||||
|
@ -123,8 +128,7 @@ def describe_klandring(strid):
|
||||||
k["description"] = text
|
k["description"] = text
|
||||||
save()
|
save()
|
||||||
|
|
||||||
menu_klandringer()
|
return code
|
||||||
|
|
||||||
|
|
||||||
def delete_klandring(strid):
|
def delete_klandring(strid):
|
||||||
id = int(strid)
|
id = int(strid)
|
||||||
|
@ -137,7 +141,17 @@ def delete_klandring(strid):
|
||||||
d.msgbox("Klandringen er slettet!")
|
d.msgbox("Klandringen er slettet!")
|
||||||
save()
|
save()
|
||||||
|
|
||||||
menu_klandringer()
|
return code
|
||||||
|
|
||||||
|
def batch_mode():
|
||||||
|
#code = create_klandring()
|
||||||
|
for i,k in enumerate(klandringer):
|
||||||
|
code = describe_klandring(i)
|
||||||
|
if code != d.OK:
|
||||||
|
break
|
||||||
|
code = edit_klandring(i)
|
||||||
|
if code != d.OK:
|
||||||
|
break
|
||||||
|
|
||||||
def save():
|
def save():
|
||||||
with open("klandringer.json","w") as jsonfile:
|
with open("klandringer.json","w") as jsonfile:
|
||||||
|
@ -156,6 +170,7 @@ def new_date():
|
||||||
else:
|
else:
|
||||||
menu_select_date()
|
menu_select_date()
|
||||||
|
|
||||||
|
|
||||||
# End definitions
|
# End definitions
|
||||||
|
|
||||||
menu_select_date()
|
menu_select_date()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user