forked from expo/troggle
simple rename survexscansfolder to scansfolder
This commit is contained in:
parent
b64c779a58
commit
9cd70b31ac
@ -376,7 +376,7 @@ class Migration(migrations.Migration):
|
|||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('ffile', models.CharField(max_length=200)),
|
('ffile', models.CharField(max_length=200)),
|
||||||
('name', models.CharField(max_length=200)),
|
('name', models.CharField(max_length=200)),
|
||||||
('survexscansfolder', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder')),
|
('scansfolder', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ('name',),
|
'ordering': ('name',),
|
||||||
@ -434,7 +434,7 @@ class Migration(migrations.Migration):
|
|||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='survexblock',
|
model_name='survexblock',
|
||||||
name='survexscansfolder',
|
name='scansfolder',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ScansFolder'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
|
@ -123,7 +123,7 @@ class SurvexBlock(models.Model):
|
|||||||
# begin_char = models.IntegerField() # code for where in the survex data files this block sits
|
# begin_char = models.IntegerField() # code for where in the survex data files this block sits
|
||||||
survexpath = models.CharField(max_length=200) # the path for the survex stations
|
survexpath = models.CharField(max_length=200) # the path for the survex stations
|
||||||
|
|
||||||
survexscansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
scansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||||
#refscandir = models.CharField(max_length=100)
|
#refscandir = models.CharField(max_length=100)
|
||||||
|
|
||||||
legsall = models.IntegerField(null=True) # summary data for this block
|
legsall = models.IntegerField(null=True) # summary data for this block
|
||||||
@ -211,16 +211,16 @@ class ScansFolder(models.Model):
|
|||||||
class SurvexScanSingle(models.Model):
|
class SurvexScanSingle(models.Model):
|
||||||
ffile = models.CharField(max_length=200)
|
ffile = models.CharField(max_length=200)
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
survexscansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
scansfolder = models.ForeignKey("ScansFolder", null=True,on_delete=models.CASCADE)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.survexscansfolder.walletname), "file":self.name}))
|
return urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.scansfolder.walletname), "file":self.name}))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Survey Scan Image: " + str(self.name) + " in " + str(self.survexscansfolder)
|
return "Survey Scan Image: " + str(self.name) + " in " + str(self.scansfolder)
|
||||||
|
|
||||||
class TunnelFile(models.Model):
|
class TunnelFile(models.Model):
|
||||||
tunnelpath = models.CharField(max_length=200)
|
tunnelpath = models.CharField(max_length=200)
|
||||||
|
@ -70,15 +70,15 @@ def SaveImageInDir(name, imgdir, project, fdata, bbinary):
|
|||||||
|
|
||||||
def surveyscansfolder(request, path):
|
def surveyscansfolder(request, path):
|
||||||
#print [ s.walletname for s in ScansFolder.objects.all() ]
|
#print [ s.walletname for s in ScansFolder.objects.all() ]
|
||||||
survexscansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
scansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||||
return render_to_response('survexscansfolder.html', { 'survexscansfolder':survexscansfolder, 'settings': settings })
|
return render_to_response('scansfolder.html', { 'scansfolder':scansfolder, 'settings': settings })
|
||||||
|
|
||||||
def surveyscansingle(request, path, file):
|
def surveyscansingle(request, path, file):
|
||||||
survexscansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
scansfolder = ScansFolder.objects.get(walletname=urllib.parse.unquote(path))
|
||||||
survexscansingle = SurvexScanSingle.objects.get(survexscansfolder=survexscansfolder, name=file)
|
survexscansingle = SurvexScanSingle.objects.get(scansfolder=scansfolder, name=file)
|
||||||
print("SSS {} {} :{}:".format(path, file, flatviews.getmimetype(file)))
|
print("SSS {} {} :{}:".format(path, file, flatviews.getmimetype(file)))
|
||||||
return HttpResponse(content=open(survexscansingle.ffile,"rb"), content_type=flatviews.getmimetype(file))
|
return HttpResponse(content=open(survexscansingle.ffile,"rb"), content_type=flatviews.getmimetype(file))
|
||||||
#return render_to_response('survexscansfolder.html', { 'survexscansfolder':survexscansfolder, 'settings': settings })
|
#return render_to_response('scansfolder.html', { 'scansfolder':scansfolder, 'settings': settings })
|
||||||
|
|
||||||
def expofilessingle(request, filepath):
|
def expofilessingle(request, filepath):
|
||||||
# defaults to content_type="text/pain" needs fixing for PDFs
|
# defaults to content_type="text/pain" needs fixing for PDFs
|
||||||
|
@ -19,7 +19,7 @@ from troggle.core.views_caves import MapLocations
|
|||||||
|
|
||||||
|
|
||||||
"""A 'survex block' is a *begin...*end set of cave data.
|
"""A 'survex block' is a *begin...*end set of cave data.
|
||||||
A 'survexscansfolder' is what we today call a "survey scans folder" or a "wallet".
|
A 'scansfolder' is what we today call a "survey scans folder" or a "wallet".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
rx_braskets= re.compile(r"[()]")
|
rx_braskets= re.compile(r"[()]")
|
||||||
@ -150,7 +150,7 @@ insp = ""
|
|||||||
callcount = 0
|
callcount = 0
|
||||||
def RecursiveLoad(survexblock, survexfile, fin):
|
def RecursiveLoad(survexblock, survexfile, fin):
|
||||||
"""Follows the *include links in all the survex files from the root file 1623.svx
|
"""Follows the *include links in all the survex files from the root file 1623.svx
|
||||||
and reads in the survex blocks, other data and the wallet references (survexscansfolder) as it
|
and reads in the survex blocks, other data and the wallet references (scansfolder) as it
|
||||||
goes. This part of the data import process is where the maximum memory is used and where it
|
goes. This part of the data import process is where the maximum memory is used and where it
|
||||||
crashes on memory-constrained machines.
|
crashes on memory-constrained machines.
|
||||||
"""
|
"""
|
||||||
@ -198,7 +198,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
|
|||||||
refscan = "%s#%s%s" % (yr, letterx, wallet )
|
refscan = "%s#%s%s" % (yr, letterx, wallet )
|
||||||
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
||||||
if manyscansfolders:
|
if manyscansfolders:
|
||||||
survexblock.survexscansfolder = manyscansfolders[0]
|
survexblock.scansfolder = manyscansfolders[0]
|
||||||
survexblock.save()
|
survexblock.save()
|
||||||
else:
|
else:
|
||||||
message = ' ! Wallet ; ref {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
message = ' ! Wallet ; ref {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
||||||
@ -264,7 +264,7 @@ def RecursiveLoad(survexblock, survexfile, fin):
|
|||||||
refscan = "%s#%s%s" % (yr, letterx, wallet)
|
refscan = "%s#%s%s" % (yr, letterx, wallet)
|
||||||
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
manyscansfolders = models_survex.ScansFolder.objects.filter(walletname=refscan)
|
||||||
if manyscansfolders:
|
if manyscansfolders:
|
||||||
survexblock.survexscansfolder = manyscansfolders[0]
|
survexblock.scansfolder = manyscansfolders[0]
|
||||||
survexblock.save()
|
survexblock.save()
|
||||||
else:
|
else:
|
||||||
message = ' ! Wallet *REF {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
message = ' ! Wallet *REF {} - NOT found in manyscansfolders {}'.format(refscan, survexblock.survexfile.path)
|
||||||
|
@ -52,10 +52,10 @@ def GetListDir(sdir):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
def LoadListScansFile(survexscansfolder):
|
def LoadListScansFile(scansfolder):
|
||||||
gld = [ ]
|
gld = [ ]
|
||||||
# flatten out any directories in these wallet folders - should not be any
|
# flatten out any directories in these wallet folders - should not be any
|
||||||
for (fyf, ffyf, fisdiryf) in GetListDir(survexscansfolder.fpath):
|
for (fyf, ffyf, fisdiryf) in GetListDir(scansfolder.fpath):
|
||||||
if fisdiryf:
|
if fisdiryf:
|
||||||
gld.extend(GetListDir(ffyf))
|
gld.extend(GetListDir(ffyf))
|
||||||
else:
|
else:
|
||||||
@ -65,7 +65,7 @@ def LoadListScansFile(survexscansfolder):
|
|||||||
for (fyf, ffyf, fisdiryf) in gld:
|
for (fyf, ffyf, fisdiryf) in gld:
|
||||||
#assert not fisdiryf, ffyf
|
#assert not fisdiryf, ffyf
|
||||||
if re.search(r"\.(?:png|jpg|jpeg|pdf|svg|gif)(?i)$", fyf):
|
if re.search(r"\.(?:png|jpg|jpeg|pdf|svg|gif)(?i)$", fyf):
|
||||||
survexscansingle = SurvexScanSingle(ffile=ffyf, name=fyf, survexscansfolder=survexscansfolder)
|
survexscansingle = SurvexScanSingle(ffile=ffyf, name=fyf, scansfolder=scansfolder)
|
||||||
survexscansingle.save()
|
survexscansingle.save()
|
||||||
c+=1
|
c+=1
|
||||||
if c>=10:
|
if c>=10:
|
||||||
@ -103,15 +103,15 @@ def LoadListScans():
|
|||||||
for fy, ffy, fisdiry in GetListDir(ff):
|
for fy, ffy, fisdiry in GetListDir(ff):
|
||||||
if fisdiry:
|
if fisdiry:
|
||||||
assert fisdiry, ffy
|
assert fisdiry, ffy
|
||||||
survexscansfolder = ScansFolder(fpath=ffy, walletname=fy)
|
scansfolder = ScansFolder(fpath=ffy, walletname=fy)
|
||||||
survexscansfolder.save()
|
scansfolder.save()
|
||||||
LoadListScansFile(survexscansfolder)
|
LoadListScansFile(scansfolder)
|
||||||
|
|
||||||
# do the
|
# do the
|
||||||
elif f != "thumbs":
|
elif f != "thumbs":
|
||||||
survexscansfolder = ScansFolder(fpath=ff, walletname=f)
|
scansfolder = ScansFolder(fpath=ff, walletname=f)
|
||||||
survexscansfolder.save()
|
scansfolder.save()
|
||||||
LoadListScansFile(survexscansfolder)
|
LoadListScansFile(scansfolder)
|
||||||
|
|
||||||
|
|
||||||
def FindTunnelScan(tunnelfile, path):
|
def FindTunnelScan(tunnelfile, path):
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h3>Survey Scans in: {{survexscansfolder.walletname}}</h3>
|
<h3>Survey Scans in: {{scansfolder.walletname}}</h3>
|
||||||
<table>
|
<table>
|
||||||
{% for survexscansingle in survexscansfolder.survexscansingle_set.all %}
|
{% for survexscansingle in scansfolder.survexscansingle_set.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="survexscansingle"><a href="{{survexscansingle.get_absolute_url}}">{{survexscansingle.name}}</a></td>
|
<td class="survexscansingle"><a href="{{survexscansingle.get_absolute_url}}">{{survexscansingle.name}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<h3>Survex surveys referring to this wallet</h3>
|
<h3>Survex surveys referring to this wallet</h3>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
{% for survexblock in survexscansfolder.survexblock_set.all %}
|
{% for survexblock in scansfolder.survexblock_set.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a></td>
|
<td><a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -13,12 +13,12 @@ hand-drawn passage sections are drawn. These hand-drawn passages will eventually
|
|||||||
traced to produce Tunnel or Therion drawings and eventually the final complete cave survey.
|
traced to produce Tunnel or Therion drawings and eventually the final complete cave survey.
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr>
|
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr>
|
||||||
{% for survexscansfolder in manyscansfolders %}
|
{% for scansfolder in manyscansfolders %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{survexscansfolder.get_absolute_url}}">{{survexscansfolder.walletname}}</a></td>
|
<td><a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a></td>
|
||||||
<td>{{survexscansfolder.survexscansingle_set.all|length}}</td>
|
<td>{{scansfolder.survexscansingle_set.all|length}}</td>
|
||||||
<td>
|
<td>
|
||||||
{% for survexblock in survexscansfolder.survexblock_set.all %}
|
{% for survexblock in scansfolder.survexblock_set.all %}
|
||||||
<a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a>
|
<a href="{% url "svx" survexblock.survexfile.path %}">{{survexblock}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -66,8 +66,8 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{% if survexblock.survexscansfolder %}
|
{% if survexblock.scansfolder %}
|
||||||
<b><a href="{{survexblock.survexscansfolder.get_absolute_url}}">{{survexblock.survexscansfolder.walletname}}</a></b>
|
<b><a href="{{survexblock.scansfolder.get_absolute_url}}">{{survexblock.scansfolder.walletname}}</a></b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<td>{{tunnelfile.npaths}}</td>
|
<td>{{tunnelfile.npaths}}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{% for survexscansfolder in tunnelfile.manyscansfolders.all %}
|
{% for scansfolder in tunnelfile.manyscansfolders.all %}
|
||||||
<a href="{{survexscansfolder.get_absolute_url}}">{{survexscansfolder.walletname}}</a>
|
<a href="{{scansfolder.get_absolute_url}}">{{scansfolder.walletname}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ class CoreSurvexblock(models.Model):
|
|||||||
expedition = models.ForeignKey(CoreExpedition, models.DO_NOTHING, blank=True, null=True)
|
expedition = models.ForeignKey(CoreExpedition, models.DO_NOTHING, blank=True, null=True)
|
||||||
expeditionday = models.ForeignKey(CoreExpeditionday, models.DO_NOTHING, blank=True, null=True)
|
expeditionday = models.ForeignKey(CoreExpeditionday, models.DO_NOTHING, blank=True, null=True)
|
||||||
survexfile = models.ForeignKey('CoreSurvexfile', models.DO_NOTHING, blank=True, null=True)
|
survexfile = models.ForeignKey('CoreSurvexfile', models.DO_NOTHING, blank=True, null=True)
|
||||||
survexscansfolder = models.ForeignKey('CoreSurvexscansfolder', models.DO_NOTHING, blank=True, null=True)
|
scansfolder = models.ForeignKey('CoreSurvexscansfolder', models.DO_NOTHING, blank=True, null=True)
|
||||||
parent = models.ForeignKey('self', models.DO_NOTHING, blank=True, null=True)
|
parent = models.ForeignKey('self', models.DO_NOTHING, blank=True, null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -429,14 +429,14 @@ class CoreSurvexscansfolder(models.Model):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'core_survexscansfolder'
|
db_table = 'core_scansfolder'
|
||||||
|
|
||||||
|
|
||||||
class CoreSurvexscansingle(models.Model):
|
class CoreSurvexscansingle(models.Model):
|
||||||
id = models.IntegerField(primary_key=True) # AutoField?
|
id = models.IntegerField(primary_key=True) # AutoField?
|
||||||
ffile = models.CharField(max_length=200)
|
ffile = models.CharField(max_length=200)
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
survexscansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING, blank=True, null=True)
|
scansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING, blank=True, null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
@ -476,12 +476,12 @@ class CoreTunnelfileSurvexscans(models.Model):
|
|||||||
class CoreTunnelfileSurvexscansfolders(models.Model):
|
class CoreTunnelfileSurvexscansfolders(models.Model):
|
||||||
id = models.IntegerField(primary_key=True) # AutoField?
|
id = models.IntegerField(primary_key=True) # AutoField?
|
||||||
tunnelfile = models.ForeignKey(CoreTunnelfile, models.DO_NOTHING)
|
tunnelfile = models.ForeignKey(CoreTunnelfile, models.DO_NOTHING)
|
||||||
survexscansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING)
|
scansfolder = models.ForeignKey(CoreSurvexscansfolder, models.DO_NOTHING)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'core_tunnelfile_survexscansfolders'
|
db_table = 'core_tunnelfile_scansfolders'
|
||||||
unique_together = (('tunnelfile', 'survexscansfolder'),)
|
unique_together = (('tunnelfile', 'scansfolder'),)
|
||||||
|
|
||||||
|
|
||||||
class CoreTunnelfileSurvextitles(models.Model):
|
class CoreTunnelfileSurvextitles(models.Model):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user