2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 14:28:09 +00:00

display drawings on wallet data

This commit is contained in:
2025-09-27 21:59:37 +03:00
parent 4d3821f572
commit deead77c08
4 changed files with 43 additions and 9 deletions

View File

@@ -434,15 +434,31 @@ class Wallet(models.Model):
files_list = self.get_fnames()
files = []
sexytopo = False
topodroid = False
zipfiles = False
for f in files_list:
if isinstance(f, Path): # ignore directories which have been turned into strings
files.append(f)
if str(f).endswith(".data.json"): # we have sexytopo data
sexytopo = True
if str(f)=="manifest" or str(f)=="survey.sql": # we probably have topodroid..
topodroid = True
if str(f).endswith(".zip") or str(f).endswith(".top"): # might be anything
zipfiles = True
if zipfiles:
print(f".zip file or .top file found at {self.walletname}")
waldata["electronic survey"] = True
if topodroid:
waldata["electronic survey"] = True
print(f"topodroid found at {self.walletname}")
if sexytopo:
waldata["electronic survey"] = True
print(f"sexytopo found at {self.walletname}")
for f in files:
# This list 'files' is only used to calculate tick lists and to colour the boxes
if str(f).endswith("ext-elevation.json"):
files.remove(f)
if str(f).endswith(".plan.json"):
@@ -466,12 +482,15 @@ class Wallet(models.Model):
plan_drawing_required = not (plan_scanned or waldata["plan drawn"] or waldata["plan not required"])
if plan_drawing_required:
if waldata["electronic survey"]:
ticks["P"] = "seagreen"
ticks["P"] = "maroon"
else:
ticks["P"] = "red"
else:
ticks["P"] = "green"
if waldata["electronic survey"]:
ticks["P"] = "limegreen"
else:
ticks["P"] = "green"
# Elev drawing required
elev_scanned = reduce(operator.or_, [f.stem.startswith("elev") for f in files], False)
elev_scanned = reduce(operator.or_, [f.stem.endswith("elev") for f in files], elev_scanned) # sexytopo does this, so we need to be clear
@@ -479,11 +498,14 @@ class Wallet(models.Model):
elev_drawing_required = not (elev_scanned or waldata["elev drawn"] or waldata["elev not required"])
if elev_drawing_required:
if waldata["electronic survey"]:
ticks["E"] = "seagreen"
ticks["E"] = "maroon"
else:
ticks["E"] = "red"
else:
ticks["E"] = "green"
if waldata["electronic survey"]:
ticks["E"] = "limegreen"
else:
ticks["E"] = "green"
# Tunnel / Therion
ticks["T"] = "red" # default is that it is not tunnelled
@@ -505,7 +527,6 @@ class Wallet(models.Model):
else:
ticks["W"] = "red"
return ticks
def __str__(self):