2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-02-18 05:00:13 +00:00

tabs and spaces format fix

This commit is contained in:
Philip Sargent 2020-05-24 13:31:38 +01:00
parent 40ad04b79f
commit 49d5857b36

View File

@ -1,5 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area, SurvexStation from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area, SurvexStation
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
@ -12,7 +14,9 @@ from django import forms
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings from django.conf import settings
import re, urlparse import re
import urlparse
#import urllib.parse
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
import settings import settings
@ -217,7 +221,7 @@ def qm(request,cave_id,qm_id,year,grade=None):
return render(request,'qm.html',locals()) return render(request,'qm.html',locals())
except QM.DoesNotExist: except QM.DoesNotExist:
url=urlparse.urljoin(settings.URL_ROOT, r'/admin/core/qm/add/'+'?'+ r'number=' + qm_id) url=urllib.parse.urljoin(settings.URL_ROOT, r'/admin/core/qm/add/'+'?'+ r'number=' + qm_id)
if grade: if grade:
url += r'&grade=' + grade url += r'&grade=' + grade
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
@ -240,7 +244,7 @@ def entranceSlug(request, slug):
def survexblock(request, survexpath): def survexblock(request, survexpath):
survexpath = re.sub("/", ".", survexpath) survexpath = re.sub("/", ".", survexpath)
print "jjjjjj", survexpath print("jjjjjj", survexpath)
survexblock = models.SurvexBlock.objects.get(survexpath=survexpath) survexblock = models.SurvexBlock.objects.get(survexpath=survexpath)
#ftext = survexblock.filecontents() #ftext = survexblock.filecontents()
ftext = survexblock.text ftext = survexblock.text
@ -335,7 +339,7 @@ maps = {
"Grießkogel Area"], "Grießkogel Area"],
} }
for n in maps.keys(): for n in list(maps.keys()):
L, T, R, B, S, name = maps[n] L, T, R, B, S, name = maps[n]
W = (R-L)/2 W = (R-L)/2
H = (T-B)/2 H = (T-B)/2
@ -407,7 +411,7 @@ def plot(surveypoint, number, point_type, label, mapcode, draw, img):
ss = SurvexStation.objects.lookup(surveypoint) ss = SurvexStation.objects.lookup(surveypoint)
E, N = ss.x, ss.y E, N = ss.x, ss.y
shortnumber = number.replace("—","") shortnumber = number.replace("—","")
(x,y) = map(int, mungecoord(E, N, mapcode, img)) (x,y) = list(map(int, mungecoord(E, N, mapcode, img)))
#imgmaps[maparea].append( [x-4, y-SIZE/2, x+4+draw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] ) #imgmaps[maparea].append( [x-4, y-SIZE/2, x+4+draw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
draw.rectangle([(x+CIRCLESIZE, y-TEXTSIZE/2), (x+CIRCLESIZE*2+draw.textsize(shortnumber)[0], y+TEXTSIZE/2)], fill="#ffffff") draw.rectangle([(x+CIRCLESIZE, y-TEXTSIZE/2), (x+CIRCLESIZE*2+draw.textsize(shortnumber)[0], y+TEXTSIZE/2)], fill="#ffffff")
draw.text((x+CIRCLESIZE * 1.5,y-TEXTSIZE/2), shortnumber, fill="#000000") draw.text((x+CIRCLESIZE * 1.5,y-TEXTSIZE/2), shortnumber, fill="#000000")
@ -438,7 +442,7 @@ def prospecting_image(request, name):
draw = ImageDraw.Draw(img) draw = ImageDraw.Draw(img)
draw.setfont(myFont) draw.setfont(myFont)
if name == "all": if name == "all":
for maparea in maps.keys(): for maparea in list(maps.keys()):
if maparea == "all": if maparea == "all":
continue continue
localm = maps[maparea] localm = maps[maparea]
@ -495,7 +499,7 @@ def prospecting_image(request, name):
(35232.64, 82910.37, 25, "181"), # Calculated from bearings (35232.64, 82910.37, 25, "181"), # Calculated from bearings
(35323.60, 81357.83, 50, "74") # From Auer map (35323.60, 81357.83, 50, "74") # From Auer map
]: ]:
(N,E,D) = map(float, (N, E, D)) (N,E,D) = list(map(float, (N, E, D)))
maparea = Cave.objects.get(kataster_number = num).getArea().short_name maparea = Cave.objects.get(kataster_number = num).getArea().short_name
lo = mungecoord(N-D, E+D, name, img) lo = mungecoord(N-D, E+D, name, img)
hi = mungecoord(N+D, E-D, name, img) hi = mungecoord(N+D, E-D, name, img)