2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 05:07:06 +00:00

rename ScansFolder class as Wallet

This commit is contained in:
Philip Sargent
2021-04-26 18:18:16 +01:00
parent dc840c9bc7
commit 0997fd0901
5 changed files with 19 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ from PIL import Image
from functools import reduce
import settings
from troggle.core.models.survex import SingleScan, ScansFolder, DrawingFile
from troggle.core.models.survex import SingleScan, Wallet, DrawingFile
from troggle.core.models.troggle import DataIssue
from troggle.core.utils import save_carefully
@@ -85,11 +85,11 @@ def LoadListScans():
print(' - Loading Survey Scans')
SingleScan.objects.all().delete()
ScansFolder.objects.all().delete()
Wallet.objects.all().delete()
print(' - deleting all scansFolder and scansSingle objects')
# first do the smkhs (large kh survey scans) directory
manyscansfoldersmkhs = ScansFolder(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
manyscansfoldersmkhs = Wallet(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs")
print("smkhs", end=' ')
if os.path.isdir(manyscansfoldersmkhs.fpath):
manyscansfoldersmkhs.save()
@@ -107,13 +107,13 @@ def LoadListScans():
print("%s" % f, end=' ')
for fy, ffy, fisdiry in GetListDir(ff):
if fisdiry:
scansfolder = ScansFolder(fpath=ffy, walletname=fy)
scansfolder = Wallet(fpath=ffy, walletname=fy)
scansfolder.save()
LoadListScansFile(scansfolder)
# do the
elif f != "thumbs":
scansfolder = ScansFolder(fpath=ff, walletname=f)
scansfolder = Wallet(fpath=ff, walletname=f)
scansfolder.save()
LoadListScansFile(scansfolder)
@@ -125,7 +125,7 @@ def find_tunnel_scan(dwgfile, path):
scansfolder, scansfile = None, None
mscansdir = re.search(r"(\d\d\d\d#X?\d+\w?|1995-96kh|92-94Surveybookkh|1991surveybook|smkhs)/(.*?(?:png|jpg|pdf|jpeg))$", path)
if mscansdir:
scansfolderl = ScansFolder.objects.filter(walletname=mscansdir.group(1))
scansfolderl = Wallet.objects.filter(walletname=mscansdir.group(1))
# This should properly detect if a list of folders is returned and do something sensible, not just pick the first.
if len(scansfolderl):
scansfolder = scansfolderl[0]