2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-19 12:23:01 +00:00

remove template in-code step 2

This commit is contained in:
2025-12-17 18:27:12 +00:00
parent 70d1db41b1
commit 677bf92565

View File

@@ -47,136 +47,8 @@ todo = """
"""
SVXPATH = Path(settings.SURVEX_DATA)
# NB this template text must be identical to that in
templatepath = settings.SURVEX_DATA / "template" / "template.svx"
survextemplatefile = """; *** THIS IS A TEMPLATE FILE - NOT WHAT YOU MIGHT BE EXPECTING ***
*** DO NOT SAVE THIS FILE WITHOUT RENAMING IT !! ***
;[Stuff in square brackets is example text to be replaced, every square bracket
; must be excised in order for the website to let you save the file]
; Also REMOVE the reminders like "; <-- CHANGE THIS DATE" once you've done it.
; A semicolon at the beginning of a line means its a comment - you can write anything
; you like after it without upsetting survex.
; An asterisk means the line does something, proceed with caution
*begin [surveyname] ; <-- always use a surveyname, do not leave this blank
; stations linked into other surveys (or likely to)
*export [1 8 12 34]
; Cave name or number:
; Area in cave surveyed/QM:
*title "" ;[Name of passage/section - delete/ignore if you are already happy with the '*begin' name]
*date [2040.07.04] ; <-- CHANGE THIS DATE
*team ["Albert Aadvark"] Tape ; <-- CHANGE THE NAMES, in quotes if more than one word in a name
; Insert as many or few people/roles as you like.
; If someone is in this file the metres surveyed will be attributed to them.
*team [Badger] Notes
*team ["Fred Fossa"] insts
*team [Grumpy] Pics
[*instrument tape "CUCC Fisco Ranger open reel"] ; <-- CHANGE THIS to actual instrument
; *Calibration: ; <-- Have you? Where?
*ref [2040#00] ; <-- WALLET NAME, CHANGE THIS TOO. Leave blank if unknown.
; the #number is on the clear plastic wallet containing the original notes
; Describe the first station, the tag (if present) and any GPS stations:
;1 Convenient point that can see down cave, and the tag and GPS boulder. Nail Polish marked.
;2 cave ID tag. Marked with tag and bolt.
;4 GPS point on 1m boulder about 9m away SW from entrance tag. Nail polish marked.
; Centreline data
; Copy and paste from the exported Sexy Topo file, include the 'alias station' line
; Add station descriptions e.g. 'top of big boulder', 'LH wall, marked/numbered'.
; Put a semicolon before non-data lines
*data normal from to length bearing gradient ignoreall
[ 1 2 5.57 034.5 -12.8 on top of boulder shaped like a rabbit ]
; what colour nail polish?:
;-----------
;Question Mark List ;(keep initial semi-colon on each line)
; The nearest-station is the name of the survey and station which are nearest to
; the QM. The resolution-station is either '-' to indicate that the QM hasn't
; been checked; or the name of the survey and station which push that QM. If a
; QM doesn't go anywhere, set the resolution-station to be the same as the
; nearest-station. Include any relevant details of how to find or push the QM in
; the textual description. Remove square brackets.
;Serial number grade(A/B/C/D/X) nearest-station resolution-station description
;[ QM1 A surveyname.3 - description of QM ]
;[ QM2 B surveyname.5 - description of QM ]
;TICKed off QMs
; if another survey exists, the resolution-station field (the dash) was filled in, e.g.
;[ QM2 B surveyname.5 anothersurvey.7 description of QM and description of progress ]
; and if it crapped out with no survey, then just repeat the station name:
;[ QM2 B surveyname.5 surveyname.5 description of QM and description of why it crapped out ]
;------------
;Cave description ;(leave "commented-out", i.e. keep the initial semi-colon on each line)
;Freeform text describing this section of the cave
; more free form text
; lots of description please. It will be copied and pasted into the Cave data page.
*end [surveyname]
;------------------------------------------------------------------
;------------------------------------------------------------------
; if doing a manual, not sexytopo survey, then you will also need all the Splays and LRUDs
; BEFORE the *end statement. If you are doing sexytopo then you should delete all this:
; Splays arranged for each survey station (NB you only need to
; explicitly flag splays if they are to named stations).
;
; Station splayID (can be a dot for an anonymous station) distance, heading, inclination
*begin
*flags splay
;[ 1 1a d h i]
;[ 1 1b d h i]
;[ 3 3a d h I]
; e.g.
;1 . 1.145 212.45 -4.39
;1 . 7.432 229.66 -28.35
;1 . 6.084 265.14 -32.88
;1 . 17.365 228.51 -56.74
*end
;------------------------------------------------------------------
;LRUDS and recorded station details (leave commented out)
;(NP=Nail Polish, LHW/RHW=Left/Right Hand Wall)
;Station Left Right Up Down Description
;[Red] nail varnish markings
*data passage station left right up down ignoreall ; THIS IS PASSAGE 1
;[1 0.8 0 5.3 1.6 NP on boulder. pt 23 on foo survey ]
;[2 0.3 1.2 6 1.2 NP '2' LHW ]
;[3 1.3 0 3.4 0.2 Rock on floor - not refindable ]
*data ; THIS IS PASSAGE 2 - REPEAT CONNECTED LRUD
;[1 0.8 0 5.3 1.6 NP on boulder. pt 23 on foo survey ]
;[2 0.3 1.2 6 1.2 NP '2' LHW ]
;[3 1.3 0 3.4 0.2 Rock on floor - not refindable ]
*data ; THIS IS PASSAGE 3 - REPEAT CONNECTED LRUD
;[1 0.8 0 5.3 1.6 NP on boulder. pt 23 on foo survey ]
;[2 0.3 1.2 6 1.2 NP '2' LHW ]
;[3 1.3 0 3.4 0.2 Rock on floor - not refindable ]
; if no LRUDs still make a note about stations:
;Stations:
;1 Convenient point that can see down cave, and the tag and GPS boulder. Nail Polish marked.
;2 cave ID tag. Marked with tag and bolt.
;3 Far wall somewhere down cave. Not marked.
;4 GPS point on 1m boulder about 9m away SW from entrance tag. Nail polish marked.
*end [surveyname]
"""
SVXPATH = settings.SURVEX_DATA
templatepath = SVXPATH / "template" / "template.svx"
def get_survexfile(filename):
"""Gets the SurvexFile object from the survex path for the file
@@ -235,12 +107,7 @@ class SvxForm(forms.Form):
self.survexfile = False
with open(templatepath,"r") as tf:
templatetext = tf.read()
templ1 = templatetext.split()
templ2 = survextemplatefile.split()
for w in range(len(templ1)):
if templ1[w] != templ2[w]:
print(w, templ1[w], templ2[w])
return survextemplatefile
return templatetext
if not self.survexfile:
if sf := get_survexfile(self.data["filename"]): # walrus!
self.survexfile = sf