mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-02-18 05:00:13 +00:00
per svxfile debug printing enabled
This commit is contained in:
parent
d2833d26cc
commit
d27a74c97b
@ -22,6 +22,9 @@ from troggle.core.views_caves import MapLocations
|
|||||||
survexblockroot = None
|
survexblockroot = None
|
||||||
ROOTBLOCK = "rootblock"
|
ROOTBLOCK = "rootblock"
|
||||||
|
|
||||||
|
debugprint = False # Turns on debug printout for just one *include file
|
||||||
|
debugprinttrigger = "caves-1623/40/old/EisSVH"
|
||||||
|
|
||||||
class SurvexLeg():
|
class SurvexLeg():
|
||||||
"""No longer a models.Model subclass, so no longer a database table
|
"""No longer a models.Model subclass, so no longer a database table
|
||||||
"""
|
"""
|
||||||
@ -177,10 +180,12 @@ class LoadingSurvex():
|
|||||||
invalid_tape = 0.0
|
invalid_tape = 0.0
|
||||||
|
|
||||||
if self.flagsstar["skiplegs"]:
|
if self.flagsstar["skiplegs"]:
|
||||||
#print("skip in ", self.flagsstar, survexblock.survexfile.path)
|
if debugprint:
|
||||||
|
print("skip in ", self.flagsstar, survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
|
|
||||||
#print("! LEG datastar type:{}++{}\n{} ".format(self.datastar["type"].upper(), survexblock.survexfile.path, sline))
|
if debugprint:
|
||||||
|
print("! LEG datastar type:{}++{}\n{} ".format(self.datastar["type"].upper(), survexblock.survexfile.path, sline))
|
||||||
# SKIP PASSAGES *data passage
|
# SKIP PASSAGES *data passage
|
||||||
if self.datastar["type"] == "passage":
|
if self.datastar["type"] == "passage":
|
||||||
return
|
return
|
||||||
@ -204,17 +209,21 @@ class LoadingSurvex():
|
|||||||
|
|
||||||
# skip all splay legs
|
# skip all splay legs
|
||||||
if ls[datastar["from"]] == ".." or ls[datastar["from"]] == ".":
|
if ls[datastar["from"]] == ".." or ls[datastar["from"]] == ".":
|
||||||
#print("Splay in ", survexblock.survexfile.path)
|
if debugprint:
|
||||||
|
print("Splay in ", survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
if ls[datastar["to"]] == ".." or ls[datastar["to"]] == ".":
|
if ls[datastar["to"]] == ".." or ls[datastar["to"]] == ".":
|
||||||
#print("Splay in ", survexblock.survexfile.path)
|
if debugprint:
|
||||||
|
print("Splay in ", survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
if self.flagsstar["splayalias"]:
|
if self.flagsstar["splayalias"]:
|
||||||
if ls[datastar["from"]] == "-":
|
if ls[datastar["from"]] == "-":
|
||||||
#print("Aliased splay in ", survexblock.survexfile.path)
|
if debugprint:
|
||||||
|
print("Aliased splay in ", survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
if ls[datastar["to"]] == "-":
|
if ls[datastar["to"]] == "-":
|
||||||
#print("Aliased splay in ", survexblock.survexfile.path)
|
if debugprint:
|
||||||
|
print("Aliased splay in ", survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -298,7 +307,7 @@ class LoadingSurvex():
|
|||||||
refline = self.rx_ref_text.match(args)
|
refline = self.rx_ref_text.match(args)
|
||||||
if refline:
|
if refline:
|
||||||
# a textual reference such as "1996-1999 Not-KH survey book pp 92-95"
|
# a textual reference such as "1996-1999 Not-KH survey book pp 92-95"
|
||||||
print(self.insp+ "*REF quoted text so ignored:"+ args)
|
# print(self.insp+ "*REF quoted text so ignored:"+ args)
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(args)< 4:
|
if len(args)< 4:
|
||||||
@ -448,7 +457,8 @@ class LoadingSurvex():
|
|||||||
argslist = args.split()
|
argslist = args.split()
|
||||||
for s in argslist:
|
for s in argslist:
|
||||||
flags.append(s)
|
flags.append(s)
|
||||||
print(" # flagslist:{}".format(flags),)
|
if debugprint:
|
||||||
|
print(" ^ flagslist:{}".format(flags),)
|
||||||
|
|
||||||
if "duplicate" in flags:
|
if "duplicate" in flags:
|
||||||
self.flagsstar["duplicate"] = True
|
self.flagsstar["duplicate"] = True
|
||||||
@ -468,6 +478,9 @@ class LoadingSurvex():
|
|||||||
# actually we do want to count duplicates as this is for "effort expended in surveying underground"
|
# actually we do want to count duplicates as this is for "effort expended in surveying underground"
|
||||||
if self.flagsstar["surface"] == True or self.flagsstar["splay"] == True:
|
if self.flagsstar["surface"] == True or self.flagsstar["splay"] == True:
|
||||||
self.flagsstar["skiplegs"] = True
|
self.flagsstar["skiplegs"] = True
|
||||||
|
if debugprint:
|
||||||
|
print(" $ flagslist:{}".format(flags),)
|
||||||
|
|
||||||
|
|
||||||
def IdentifyCave(self, cavepath):
|
def IdentifyCave(self, cavepath):
|
||||||
if cavepath.lower() in self.caveslist:
|
if cavepath.lower() in self.caveslist:
|
||||||
@ -521,10 +534,11 @@ class LoadingSurvex():
|
|||||||
Creates a new current survexfile and valid .survexdirectory
|
Creates a new current survexfile and valid .survexdirectory
|
||||||
The survexblock passed-in is not necessarily the parent. FIX THIS.
|
The survexblock passed-in is not necessarily the parent. FIX THIS.
|
||||||
"""
|
"""
|
||||||
# print(" # datastack in LoadSurvexFile:{} 'type':".format(svxid), end="")
|
if debugprint:
|
||||||
# for dict in self.datastack:
|
print(" # datastack in LoadSurvexFile:{} 'type':".format(svxid), end="")
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
for dict in self.datastack:
|
||||||
# print("")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
|
print("")
|
||||||
|
|
||||||
|
|
||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
@ -566,23 +580,30 @@ class LoadingSurvex():
|
|||||||
print(newdirectory.primarysurvexfile, file=sys.stderr)
|
print(newdirectory.primarysurvexfile, file=sys.stderr)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# print(" # datastack end LoadSurvexFile:{} 'type':".format(svxid), end="")
|
if debugprint:
|
||||||
# for dict in self.datastack:
|
print(" # datastack end LoadSurvexFile:{} 'type':".format(svxid), end="")
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
for dict in self.datastack:
|
||||||
# print("")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
pass
|
print("")
|
||||||
|
|
||||||
def ProcessIncludeLine(self, included):
|
def ProcessIncludeLine(self, included):
|
||||||
|
global debugprint
|
||||||
svxid = included.groups()[0]
|
svxid = included.groups()[0]
|
||||||
|
if svxid.lower() == debugprinttrigger.lower():
|
||||||
|
debugprint = True
|
||||||
self.LoadSurvexFile(svxid)
|
self.LoadSurvexFile(svxid)
|
||||||
self.stacksvxfiles.append(self.currentsurvexfile)
|
self.stacksvxfiles.append(self.currentsurvexfile)
|
||||||
|
|
||||||
def ProcessEdulcniLine(self, edulcni):
|
def ProcessEdulcniLine(self, edulcni):
|
||||||
"""Saves the current survexfile in the db
|
"""Saves the current survexfile in the db
|
||||||
"""
|
"""
|
||||||
|
global debugprint
|
||||||
svxid = edulcni.groups()[0]
|
svxid = edulcni.groups()[0]
|
||||||
#depth = " " * self.depthbegin
|
if debugprint:
|
||||||
#print("{:2}{} - Edulcni survexfile:'{}'".format(self.depthbegin, depth, svxid))
|
depth = " " * self.depthbegin
|
||||||
|
print("{:2}{} - Edulcni survexfile:'{}'".format(self.depthbegin, depth, svxid))
|
||||||
|
if svxid.lower() == debugprinttrigger.lower():
|
||||||
|
debugprint = False
|
||||||
self.currentsurvexfile.save()
|
self.currentsurvexfile.save()
|
||||||
self.currentsurvexfile = self.stacksvxfiles.pop()
|
self.currentsurvexfile = self.stacksvxfiles.pop()
|
||||||
|
|
||||||
@ -667,9 +688,9 @@ class LoadingSurvex():
|
|||||||
print(" ", file=sys.stderr,end='')
|
print(" ", file=sys.stderr,end='')
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
def addpersonlengths():
|
# def addpersonlengths():
|
||||||
for personexpedition in self.currentpersonexped:
|
# for personexpedition in self.currentpersonexped:
|
||||||
personexpedition.legslength += self.slength
|
# personexpedition.legslength += self.slength
|
||||||
|
|
||||||
def printbegin():
|
def printbegin():
|
||||||
nonlocal blkid
|
nonlocal blkid
|
||||||
@ -693,20 +714,21 @@ class LoadingSurvex():
|
|||||||
|
|
||||||
def pushblock():
|
def pushblock():
|
||||||
nonlocal blkid
|
nonlocal blkid
|
||||||
|
if debugprint:
|
||||||
# print(" # datastack at 1 *begin {} 'type':".format(blkid), end="")
|
print(" # datastack at 1 *begin {} 'type':".format(blkid), end="")
|
||||||
# for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
# print("")
|
print("")
|
||||||
# print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
self.datastack.append(copy.deepcopy(self.datastar))
|
self.datastack.append(copy.deepcopy(self.datastar))
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
# print(" # datastack at 2 *begin {} 'type':".format(blkid), end="")
|
if debugprint:
|
||||||
# for dict in self.datastack:
|
print(" # datastack at 2 *begin {} 'type':".format(blkid), end="")
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
for dict in self.datastack:
|
||||||
# print("")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
# print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print("")
|
||||||
|
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
||||||
|
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
self.flagsstack.append(copy.deepcopy(self.flagsstar))
|
self.flagsstack.append(copy.deepcopy(self.flagsstar))
|
||||||
@ -716,26 +738,28 @@ class LoadingSurvex():
|
|||||||
def popblock():
|
def popblock():
|
||||||
nonlocal blkid
|
nonlocal blkid
|
||||||
nonlocal oldflags
|
nonlocal oldflags
|
||||||
|
if debugprint:
|
||||||
# print(" # datastack at *end '{} 'type':".format(blkid), end="")
|
print(" # datastack at *end '{} 'type':".format(blkid), end="")
|
||||||
# for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
# print("")
|
print("")
|
||||||
# print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
self.datastar = copy.deepcopy(self.datastack.pop())
|
self.datastar = copy.deepcopy(self.datastack.pop())
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
# print(" # datastack after *end '{} 'type':".format(blkid), end="")
|
if debugprint:
|
||||||
# for dict in self.datastack:
|
print(" # datastack after *end '{} 'type':".format(blkid), end="")
|
||||||
# print("'{}' ".format(dict["type"].upper()), end="")
|
for dict in self.datastack:
|
||||||
# print("")
|
print("'{}' ".format(dict["type"].upper()), end="")
|
||||||
# print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print("")
|
||||||
|
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
||||||
|
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
self.flagsstar = copy.deepcopy(self.flagsstack.pop())
|
self.flagsstar = copy.deepcopy(self.flagsstack.pop())
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
if debugprint:
|
||||||
print(" # POP 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
||||||
|
print(" # POP 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
||||||
|
|
||||||
def starstatement(star):
|
def starstatement(star):
|
||||||
nonlocal survexblock
|
nonlocal survexblock
|
||||||
@ -777,7 +801,6 @@ class LoadingSurvex():
|
|||||||
elif self.rx_end.match(cmd):
|
elif self.rx_end.match(cmd):
|
||||||
survexblock.legsall = self.legsnumber
|
survexblock.legsall = self.legsnumber
|
||||||
survexblock.legslength = self.slength
|
survexblock.legslength = self.slength
|
||||||
addpersonlengths()
|
|
||||||
printend()
|
printend()
|
||||||
slengthtotal += self.slength
|
slengthtotal += self.slength
|
||||||
nlegstotal += self.legsnumber
|
nlegstotal += self.legsnumber
|
||||||
@ -816,8 +839,9 @@ class LoadingSurvex():
|
|||||||
elif self.rx_flags.match(cmd):
|
elif self.rx_flags.match(cmd):
|
||||||
oldflags = self.flagsstar
|
oldflags = self.flagsstar
|
||||||
self.LoadSurvexFlags(args)
|
self.LoadSurvexFlags(args)
|
||||||
# if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
if debugprint:
|
||||||
# print(" # CHANGE 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
||||||
|
print(" # CHANGE 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
||||||
|
|
||||||
elif self.rx_data.match(cmd):
|
elif self.rx_data.match(cmd):
|
||||||
self.LoadSurvexDataCmd(survexblock, args)
|
self.LoadSurvexDataCmd(survexblock, args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user