summaryrefslogtreecommitdiffstats
path: root/core/views/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-14 21:08:06 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-14 21:08:06 +0100
commitd598a6d0f5174ede98aea4d5220c38ffdcae31ab (patch)
tree075e1cd2de514f8936b89aed363ddf8b99ef3ddb /core/views/survex.py
parentdb3addc81927085df2e3936cefa35b6dce06b0cb (diff)
downloadtroggle-d598a6d0f5174ede98aea4d5220c38ffdcae31ab.tar.gz
troggle-d598a6d0f5174ede98aea4d5220c38ffdcae31ab.tar.bz2
troggle-d598a6d0f5174ede98aea4d5220c38ffdcae31ab.zip
better integration of svx file DatIssues
Diffstat (limited to 'core/views/survex.py')
-rw-r--r--core/views/survex.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/views/survex.py b/core/views/survex.py
index 350c404..df8a629 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -104,10 +104,13 @@ class SvxForm(forms.Form):
outputtype = forms.CharField(widget=forms.TextInput(attrs={"readonly":True}))
code = forms.CharField(widget=forms.Textarea(attrs={"cols":150, "rows":36}))
+ template = False
+
def GetDiscCode(self):
fname = survexdatasetpath / (self.data['filename'] + ".svx")
if not os.path.isfile(fname):
print(">>> >>> WARNING - svx file not found, showing TEMPLATE SVX",fname, flush=True)
+ self.template = True
return survextemplatefile
fin = open(fname, "rt",encoding='utf8',newline='')
svxtext = fin.read()
@@ -167,6 +170,8 @@ def svx(request, survex_file):
editing) with buttons which allow SAVE, check for DIFFerences from saved, and RUN (which runs the
cavern executable and displays the output below the main textarea). Requires CSRF to be set upcorrect;ly, and requires permission to write to the filesystem.
'''
+ warning = False
+
# get the basic data from the file given in the URL
dirname = os.path.split(survex_file)[0]
dirname += "/"
@@ -210,7 +215,8 @@ def svx(request, survex_file):
#process(survex_file)
if 'code' not in form.data:
form.data['code'] = form.GetDiscCode()
-
+ if form.template:
+ warning = True
if not difflist:
difflist.append("none")
if message:
@@ -220,6 +226,7 @@ def svx(request, survex_file):
svxincludes = re.findall(r'\*include\s+(\S+)(?i)', form.data['code'] or "")
vmap = {'settings': settings,
+ 'warning': warning,
'has_3d': os.path.isfile(survexdatasetpath / survex_file / ".3d"),
'title': survex_file,
'svxincludes': svxincludes,