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