mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
Survex editor now parses edited files
This commit is contained in:
@@ -27,8 +27,11 @@ class SurvexDirectory(models.Model):
|
||||
ordering = ("id",)
|
||||
verbose_name_plural = "Survex directories"
|
||||
|
||||
def contents(self):
|
||||
return "[SvxDir:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]"
|
||||
|
||||
def __str__(self):
|
||||
return "[SurvexDirectory:" + str(self.path) + " | Primary svx:" + str(self.primarysurvexfile.path) + ".svx ]"
|
||||
return "[SvxDir:" + str(self.path)+ "]"
|
||||
|
||||
|
||||
class SurvexFile(models.Model):
|
||||
@@ -44,13 +47,11 @@ class SurvexFile(models.Model):
|
||||
# return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
|
||||
|
||||
def exists(self):
|
||||
"""This is only used within the Django templates
|
||||
"""
|
||||
fname = Path(settings.SURVEX_DATA, self.path + ".svx")
|
||||
return fname.is_file()
|
||||
|
||||
def OpenFile(self):
|
||||
fname = os.path.join(settings.SURVEX_DATA, self.path + ".svx")
|
||||
return open(fname)
|
||||
|
||||
def SetDirectory(self):
|
||||
dirpath = os.path.split(self.path)[0]
|
||||
# pointless search every time we import a survex file if we know there are no duplicates..
|
||||
@@ -64,6 +65,10 @@ class SurvexFile(models.Model):
|
||||
self.survexdirectory = survexdirectory
|
||||
self.save()
|
||||
|
||||
# Don't change from the default as that breaks troggle webpages and internal referencing!
|
||||
# def __str__(self):
|
||||
# return "[SurvexFile:"+str(self.path) + "-" + str(self.survexdirectory) + "-" + str(self.cave)+"]"
|
||||
|
||||
def __str__(self):
|
||||
return self.path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user