2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-04-03 09:21:48 +01:00

rename Tunnel files to Drawings files - phase 1

This commit is contained in:
Philip Sargent 2020-06-30 15:52:29 +01:00
parent 0a57ac3132
commit f76e0d3a16
3 changed files with 24 additions and 20 deletions

View File

@ -32,7 +32,7 @@ from django.contrib.auth.models import User
from troggle.core.models import get_process_memory from troggle.core.models import get_process_memory
from troggle.core.models_caves import Cave, Entrance from troggle.core.models_caves import Cave, Entrance
from troggle.parsers.imports import import_caves, import_people, import_surveyscans, \ from troggle.parsers.imports import import_caves, import_people, import_surveyscans, \
import_logbooks, import_QMs, import_survex, import_loadpos, import_tunnelfiles import_logbooks, import_QMs, import_survex, import_loadpos, import_drawingsfiles
import troggle.logbooksdump import troggle.logbooksdump
if os.geteuid() == 0: if os.geteuid() == 0:
@ -140,7 +140,7 @@ class JobQueue():
self.results_order=[ self.results_order=[
"date","runlabel","reinit", "caves", "people", "date","runlabel","reinit", "caves", "people",
"logbooks", "QMs", "scans", "survex", "logbooks", "QMs", "scans", "survex",
"tunnel", "test" ] "drawings", "test" ]
for k in self.results_order: for k in self.results_order:
self.results[k]=[] self.results[k]=[]
self.tfile = "import_profile.json" self.tfile = "import_profile.json"
@ -285,7 +285,7 @@ def usage():
QMs - read in the QM csv files (older caves only) QMs - read in the QM csv files (older caves only)
scans - the survey scans in all the wallets (must run before survex) scans - the survey scans in all the wallets (must run before survex)
survex - read in the survex files - all the survex blocks and entrances x/y/z survex - read in the survex files - all the survex blocks and entrances x/y/z
tunnel - read in the Tunnel files - which scans the survey scans too drawings - read in the Tunnel & Therion files - which scans the survey scans too
autologbooks - Not used. read in autologbooks (what are these?) autologbooks - Not used. read in autologbooks (what are these?)
dumplogbooks - Not used. write out autologbooks (not working?) dumplogbooks - Not used. write out autologbooks (not working?)
@ -334,7 +334,7 @@ if __name__ == "__main__":
jq.enq("scans",import_surveyscans) jq.enq("scans",import_surveyscans)
jq.enq("logbooks",import_logbooks) jq.enq("logbooks",import_logbooks)
jq.enq("QMs",import_QMs) jq.enq("QMs",import_QMs)
jq.enq("tunnel",import_tunnelfiles) jq.enq("drawings",import_drawingsfiles)
jq.enq("survex",import_survex) jq.enq("survex",import_survex)
elif "scans" in sys.argv: elif "scans" in sys.argv:
jq.enq("scans",import_surveyscans) jq.enq("scans",import_surveyscans)
@ -342,8 +342,8 @@ if __name__ == "__main__":
jq.enq("survex",import_survex) jq.enq("survex",import_survex)
elif "loadpos" in sys.argv: elif "loadpos" in sys.argv:
jq.enq("survex",import_loadpos) jq.enq("survex",import_loadpos)
elif "tunnel" in sys.argv: elif "drawings" in sys.argv:
jq.enq("tunnel",import_tunnelfiles) jq.enq("drawings",import_drawingsfiles)
elif "autologbooks" in sys.argv: # untested in 2020 elif "autologbooks" in sys.argv: # untested in 2020
import_auto_logbooks() import_auto_logbooks()
elif "dumplogbooks" in sys.argv: # untested in 2020 elif "dumplogbooks" in sys.argv: # untested in 2020

View File

@ -52,7 +52,7 @@ def import_loadpos():
print(" - Survex entrances x/y/z Positions") print(" - Survex entrances x/y/z Positions")
troggle.parsers.survex.LoadPos() troggle.parsers.survex.LoadPos()
def import_tunnelfiles(): def import_drawingsfiles():
print("Importing Tunnel files") print("Importing Drawings files")
troggle.parsers.surveys.LoadTunnelFiles() troggle.parsers.surveys.LoadDrawingFiles()

View File

@ -15,6 +15,8 @@ import settings
#from troggle.core.models import * #from troggle.core.models import *
#from troggle.core.models_caves import * #from troggle.core.models_caves import *
from troggle.core.models_survex import SingleScan, ScansFolder, TunnelFile from troggle.core.models_survex import SingleScan, ScansFolder, TunnelFile
from troggle.core.models import DataIssue
def get_or_create_placeholder(year): def get_or_create_placeholder(year):
""" All surveys must be related to a logbookentry. We don't have a way to """ All surveys must be related to a logbookentry. We don't have a way to
@ -177,22 +179,24 @@ def SetTunnelfileInfo(tunnelfile):
tunnelfile.save() tunnelfile.save()
def LoadTunnelFiles(): def LoadDrawingFiles():
tunneldatadir = settings.TUNNEL_DATA drawdatadir = settings.TUNNEL_DATA
TunnelFile.objects.all().delete() TunnelFile.objects.all().delete()
tunneldirs = [ "" ] DataIssue.objects.filter(parser='drawings').delete()
while tunneldirs:
tunneldir = tunneldirs.pop() drawingsdirs = [ "" ]
for f in os.listdir(os.path.join(tunneldatadir, tunneldir)): while drawingsdirs:
drawdir = drawingsdirs.pop()
for f in os.listdir(os.path.join(drawdatadir, drawdir)):
if f[0] == "." or f[-1] == "~": if f[0] == "." or f[-1] == "~":
continue continue
lf = os.path.join(tunneldir, f) lf = os.path.join(drawdir, f)
ff = os.path.join(tunneldatadir, lf) ff = os.path.join(drawdatadir, lf)
if os.path.isdir(ff): if os.path.isdir(ff):
tunneldirs.append(lf) drawingsdirs.append(lf)
elif f[-4:] == ".xml": elif f[-4:] == ".xml":
tunnelfile = TunnelFile(tunnelpath=lf, tunnelname=os.path.split(f[:-4])[1]) tunnelfile = TunnelFile(tunnelpath=lf, tunnelname=os.path.split(f[:-4])[1])
tunnelfile.save() tunnelfile.save()
for tunnelfile in TunnelFile.objects.all(): for drawfile in TunnelFile.objects.all():
SetTunnelfileInfo(tunnelfile) SetTunnelfileInfo(drawfile)