mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-12-03 23:22:18 +00:00
Whitespace cleanup
This commit is contained in:
parent
978270b152
commit
92b273e45f
@ -29,7 +29,7 @@ def getCave(cave_id):
|
|||||||
return cave
|
return cave
|
||||||
|
|
||||||
def pad5(x):
|
def pad5(x):
|
||||||
return "0" * (5 -len(x.group(0))) + x.group(0)
|
return "0" * (5 -len(x.group(0))) + x.group(0)
|
||||||
def padnumber(x):
|
def padnumber(x):
|
||||||
return re.sub("\d+", pad5, x)
|
return re.sub("\d+", pad5, x)
|
||||||
def numericalcmp(x, y):
|
def numericalcmp(x, y):
|
||||||
@ -46,7 +46,7 @@ def caveCmp(x, y):
|
|||||||
else:
|
else:
|
||||||
if y.kataster_number:
|
if y.kataster_number:
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return numericalcmp(x.unofficial_number, y.unofficial_number)
|
return numericalcmp(x.unofficial_number, y.unofficial_number)
|
||||||
|
|
||||||
def caveindex(request):
|
def caveindex(request):
|
||||||
@ -62,7 +62,6 @@ def caveindex(request):
|
|||||||
def millenialcaves(request):
|
def millenialcaves(request):
|
||||||
#RW messing around area
|
#RW messing around area
|
||||||
return HttpResponse("Test text", content_type="text/plain")
|
return HttpResponse("Test text", content_type="text/plain")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cave3d(request, cave_id=''):
|
def cave3d(request, cave_id=''):
|
||||||
@ -154,14 +153,14 @@ def edit_cave(request, slug=None):
|
|||||||
ceinst.cave = cave
|
ceinst.cave = cave
|
||||||
ceinst.save()
|
ceinst.save()
|
||||||
cave.writeDataFile()
|
cave.writeDataFile()
|
||||||
return HttpResponseRedirect("/" + cave.url)
|
return HttpResponseRedirect("/" + cave.url)
|
||||||
else:
|
else:
|
||||||
form = CaveForm(instance=cave)
|
form = CaveForm(instance=cave)
|
||||||
ceFormSet = CaveAndEntranceFormSet(queryset=cave.caveandentrance_set.all())
|
ceFormSet = CaveAndEntranceFormSet(queryset=cave.caveandentrance_set.all())
|
||||||
versionControlForm = VersionControlCommentForm()
|
versionControlForm = VersionControlCommentForm()
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'editcave2.html',
|
'editcave2.html',
|
||||||
{'form': form,
|
{'form': form,
|
||||||
'caveAndEntranceFormSet': ceFormSet,
|
'caveAndEntranceFormSet': ceFormSet,
|
||||||
'versionControlForm': versionControlForm
|
'versionControlForm': versionControlForm
|
||||||
@ -169,7 +168,7 @@ def edit_cave(request, slug=None):
|
|||||||
|
|
||||||
@login_required_if_public
|
@login_required_if_public
|
||||||
def editEntrance(request, caveslug, slug=None):
|
def editEntrance(request, caveslug, slug=None):
|
||||||
cave = Cave.objects.get(caveslug__slug = caveslug)
|
cave = Cave.objects.get(caveslug__slug = caveslug)
|
||||||
if slug is not None:
|
if slug is not None:
|
||||||
entrance = Entrance.objects.get(entranceslug__slug = slug)
|
entrance = Entrance.objects.get(entranceslug__slug = slug)
|
||||||
else:
|
else:
|
||||||
@ -196,7 +195,7 @@ def editEntrance(request, caveslug, slug=None):
|
|||||||
el.entrance = entrance
|
el.entrance = entrance
|
||||||
el.save()
|
el.save()
|
||||||
entrance.writeDataFile()
|
entrance.writeDataFile()
|
||||||
return HttpResponseRedirect("/" + cave.url)
|
return HttpResponseRedirect("/" + cave.url)
|
||||||
else:
|
else:
|
||||||
form = EntranceForm(instance = entrance)
|
form = EntranceForm(instance = entrance)
|
||||||
versionControlForm = VersionControlCommentForm()
|
versionControlForm = VersionControlCommentForm()
|
||||||
@ -204,8 +203,8 @@ def editEntrance(request, caveslug, slug=None):
|
|||||||
entletter = EntranceLetterForm(request.POST)
|
entletter = EntranceLetterForm(request.POST)
|
||||||
else:
|
else:
|
||||||
entletter = None
|
entletter = None
|
||||||
return render(request,
|
return render(request,
|
||||||
'editentrance.html',
|
'editentrance.html',
|
||||||
{'form': form,
|
{'form': form,
|
||||||
'versionControlForm': versionControlForm,
|
'versionControlForm': versionControlForm,
|
||||||
'entletter': entletter
|
'entletter': entletter
|
||||||
@ -221,9 +220,8 @@ def qm(request,qm_id):
|
|||||||
if grade:
|
if grade:
|
||||||
url += r'&grade=' + grade
|
url += r'&grade=' + grade
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def ent(request, cave_id, ent_letter):
|
def ent(request, cave_id, ent_letter):
|
||||||
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
||||||
cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0]
|
cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0]
|
||||||
@ -255,7 +253,7 @@ def survey(request,year,wallet_number):
|
|||||||
surveys=Survey.objects.all()
|
surveys=Survey.objects.all()
|
||||||
expeditions=Expedition.objects.order_by("-year")
|
expeditions=Expedition.objects.order_by("-year")
|
||||||
current_expedition=Expedition.objects.filter(year=year)[0]
|
current_expedition=Expedition.objects.filter(year=year)[0]
|
||||||
|
|
||||||
if wallet_number!='':
|
if wallet_number!='':
|
||||||
current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0]
|
current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0]
|
||||||
notes=current_survey.scannedimage_set.filter(contents='notes')
|
notes=current_survey.scannedimage_set.filter(contents='notes')
|
||||||
@ -313,7 +311,7 @@ def prospecting(request):
|
|||||||
caves.sort(caveCmp)
|
caves.sort(caveCmp)
|
||||||
areas.append((name, a, caves))
|
areas.append((name, a, caves))
|
||||||
return render(request, 'prospecting.html', {"areas": areas})
|
return render(request, 'prospecting.html', {"areas": areas})
|
||||||
|
|
||||||
# Parameters for big map and zoomed subarea maps:
|
# Parameters for big map and zoomed subarea maps:
|
||||||
# big map first (zoom factor ignored)
|
# big map first (zoom factor ignored)
|
||||||
|
|
||||||
@ -343,7 +341,7 @@ for n in maps.keys():
|
|||||||
for j in range(2):
|
for j in range(2):
|
||||||
maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name]
|
maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name]
|
||||||
# Keys in the order in which we want the maps output
|
# Keys in the order in which we want the maps output
|
||||||
mapcodes = ["all", "grieß","40", "76", "204", "tc"]
|
mapcodes = ["all", "grieß","40", "76", "204", "tc"]
|
||||||
# Field codes
|
# Field codes
|
||||||
L = 0
|
L = 0
|
||||||
T = 1
|
T = 1
|
||||||
@ -400,7 +398,7 @@ def mungecoord(x, y, mapcode, img):
|
|||||||
COL_TYPES = {True: "red",
|
COL_TYPES = {True: "red",
|
||||||
False: "#dddddd",
|
False: "#dddddd",
|
||||||
"Reference": "#dddddd"}
|
"Reference": "#dddddd"}
|
||||||
|
|
||||||
def plot(surveypoint, number, point_type, label, mapcode, draw, img):
|
def plot(surveypoint, number, point_type, label, mapcode, draw, img):
|
||||||
try:
|
try:
|
||||||
ss = SurvexStation.objects.lookup(surveypoint)
|
ss = SurvexStation.objects.lookup(surveypoint)
|
||||||
@ -509,8 +507,8 @@ def prospecting_image(request, name):
|
|||||||
del draw
|
del draw
|
||||||
img.save(response, "PNG")
|
img.save(response, "PNG")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
STATIONS = {}
|
STATIONS = {}
|
||||||
poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$")
|
poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$")
|
||||||
def LoadPos():
|
def LoadPos():
|
||||||
call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA])
|
call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA])
|
||||||
@ -518,7 +516,7 @@ def LoadPos():
|
|||||||
posfile = open("%sall.pos" % settings.SURVEX_DATA)
|
posfile = open("%sall.pos" % settings.SURVEX_DATA)
|
||||||
posfile.readline()#Drop header
|
posfile.readline()#Drop header
|
||||||
for line in posfile.readlines():
|
for line in posfile.readlines():
|
||||||
r = poslineregex.match(line)
|
r = poslineregex.match(line)
|
||||||
if r:
|
if r:
|
||||||
x, y, z, name = r.groups()
|
x, y, z, name = r.groups()
|
||||||
STATIONS[name] = (x, y, z)
|
STATIONS[name] = (x, y, z)
|
||||||
|
@ -10,9 +10,9 @@ RUN apt-get -y update && apt-get install -y mercurial \
|
|||||||
|
|
||||||
# Set the locale
|
# Set the locale
|
||||||
RUN locale-gen en_GB.UTF-8
|
RUN locale-gen en_GB.UTF-8
|
||||||
ENV LANG en_GB.UTF-8
|
ENV LANG en_GB.UTF-8
|
||||||
ENV LANGUAGE en_GB:en
|
ENV LANGUAGE en_GB:en
|
||||||
ENV LC_ALL en_GB.UTF-8
|
ENV LC_ALL en_GB.UTF-8
|
||||||
|
|
||||||
WORKDIR /opt/expo/troggle
|
WORKDIR /opt/expo/troggle
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
@ -33,7 +33,6 @@ def flatpage(request, path):
|
|||||||
except EntranceRedirect.DoesNotExist:
|
except EntranceRedirect.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated():
|
if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated():
|
||||||
print("flat path noinfo", path)
|
print("flat path noinfo", path)
|
||||||
return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path)
|
return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path)
|
||||||
@ -48,7 +47,7 @@ def flatpage(request, path):
|
|||||||
path = path + "index.htm"
|
path = path + "index.htm"
|
||||||
except IOError:
|
except IOError:
|
||||||
return render(request, 'pagenotfound.html', {'path': path})
|
return render(request, 'pagenotfound.html', {'path': path})
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
filetobeopened = os.path.normpath(settings.EXPOWEB + path)
|
filetobeopened = os.path.normpath(settings.EXPOWEB + path)
|
||||||
o = open(filetobeopened, "rb")
|
o = open(filetobeopened, "rb")
|
||||||
@ -56,7 +55,7 @@ def flatpage(request, path):
|
|||||||
return render(request, 'pagenotfound.html', {'path': path})
|
return render(request, 'pagenotfound.html', {'path': path})
|
||||||
if path.endswith(".htm") or path.endswith(".html"):
|
if path.endswith(".htm") or path.endswith(".html"):
|
||||||
html = o.read()
|
html = o.read()
|
||||||
|
|
||||||
m = re.search(r"(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)", html, re.DOTALL + re.IGNORECASE)
|
m = re.search(r"(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)", html, re.DOTALL + re.IGNORECASE)
|
||||||
if m:
|
if m:
|
||||||
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
|
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
|
||||||
@ -125,7 +124,7 @@ def editflatpage(request, path):
|
|||||||
return HttpResponse("Page could not be split into header and body")
|
return HttpResponse("Page could not be split into header and body")
|
||||||
except IOError:
|
except IOError:
|
||||||
filefound = False
|
filefound = False
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST': # If the form has been submitted...
|
if request.method == 'POST': # If the form has been submitted...
|
||||||
flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data
|
flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data
|
||||||
@ -142,7 +141,7 @@ def editflatpage(request, path):
|
|||||||
headerargs = ""
|
headerargs = ""
|
||||||
postheader = ""
|
postheader = ""
|
||||||
bodyargs = ""
|
bodyargs = ""
|
||||||
postbody = "</html>"
|
postbody = "</html>"
|
||||||
body = flatpageForm.cleaned_data["html"]
|
body = flatpageForm.cleaned_data["html"]
|
||||||
body = body.replace("\r", "")
|
body = body.replace("\r", "")
|
||||||
result = u"%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
|
result = u"%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
|
||||||
@ -153,7 +152,7 @@ def editflatpage(request, path):
|
|||||||
else:
|
else:
|
||||||
if filefound:
|
if filefound:
|
||||||
m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
|
m = re.search(r"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
|
||||||
if m:
|
if m:
|
||||||
title, = m.groups()
|
title, = m.groups()
|
||||||
else:
|
else:
|
||||||
title = ""
|
title = ""
|
||||||
|
@ -166,7 +166,7 @@ def Parseloghtmltxt(year, expedition, txt):
|
|||||||
for trippara in tripparas:
|
for trippara in tripparas:
|
||||||
#print(" - HR detected - maybe a trip?")
|
#print(" - HR detected - maybe a trip?")
|
||||||
logbook_entry_count += 1
|
logbook_entry_count += 1
|
||||||
|
|
||||||
s = re.match(r'''(?x)(?:\s*<div\sclass="tripdate"\sid=".*?">.*?</div>\s*<p>)? # second date
|
s = re.match(r'''(?x)(?:\s*<div\sclass="tripdate"\sid=".*?">.*?</div>\s*<p>)? # second date
|
||||||
\s*(?:<a\s+id="(.*?)"\s*/>\s*</a>)?
|
\s*(?:<a\s+id="(.*?)"\s*/>\s*</a>)?
|
||||||
\s*<div\s+class="tripdate"\s*(?:id="(.*?)")?>(.*?)</div>(?:<p>)?
|
\s*<div\s+class="tripdate"\s*(?:id="(.*?)")?>(.*?)</div>(?:<p>)?
|
||||||
|
@ -17,7 +17,7 @@ div.cv-panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.cv-compass, div.cv-ahi {
|
div.cv-compass, div.cv-ahi {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 95px;
|
bottom: 95px;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -31,7 +31,7 @@ div.cv-compass, div.cv-ahi {
|
|||||||
background-color: black;
|
background-color: black;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.cv-ahi {
|
div.cv-ahi {
|
||||||
right: 95px;
|
right: 95px;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ div.linear-scale-caption {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 64px;
|
top: 64px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin-top:0;
|
margin-top:0;
|
||||||
bottom: 44px;
|
bottom: 44px;
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
@ -220,7 +220,7 @@ div.linear-scale-caption {
|
|||||||
}
|
}
|
||||||
#frame .tab {
|
#frame .tab {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0px;lass="cavedisplay"
|
right: 0px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -523,7 +523,7 @@ div#scene {
|
|||||||
{% endif %} {{ ent.entrance.other_location.y|safe }}, {{ ent.entrance.other_location.x|safe }}, {{ ent.entrance.other_location.z|safe }}m
|
{% endif %} {{ ent.entrance.other_location.y|safe }}, {{ ent.entrance.other_location.x|safe }}, {{ ent.entrance.other_location.z|safe }}m
|
||||||
</dd>
|
</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user