mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 18:47:06 +00:00
moved stuff
This commit is contained in:
@@ -15,8 +15,6 @@ for tunnel and therion files
|
||||
todo = """
|
||||
- Rename functions more consistently between tunnel and therion variants
|
||||
|
||||
- fix missed embedded survex files and their *ref wallet
|
||||
|
||||
- Refactor to use pathlib instead of whacky resetting of loop variable inside loop
|
||||
to scan sub-folders. This will definitely break at some point..
|
||||
|
||||
@@ -26,6 +24,17 @@ todo = """
|
||||
Tries to link the scrap (Therion format) to the referenced therion scrap
|
||||
"""
|
||||
|
||||
rx_xth_me = re.compile(r"xth_me_image_insert.*{.*}$", re.MULTILINE)
|
||||
rx_scrap = re.compile(r"^survey (\w*).*$", re.MULTILINE)
|
||||
rx_input = re.compile(r"^input ", re.MULTILINE)
|
||||
rx_line = re.compile(r"^line ", re.MULTILINE)
|
||||
rx_ref = re.compile(r"^#?\s?ref\s*\:?\s*([^\s\t]*)", re.MULTILINE)
|
||||
|
||||
rx_skpath = re.compile(r"<skpath")
|
||||
rx_pcpath = re.compile(r'<pcarea area_signal="frame".*?sfsketch="([^"]*)" sfstyle="([^"]*)"')
|
||||
rx_pctext = re.compile(r'pctext.*?\*ref&space;([^&]*)')
|
||||
|
||||
|
||||
rx_valid_ext = re.compile(r"(?i)\.(?:png|jpg|pdf|jpeg|gif|txt|svg)$")
|
||||
rx_wallet = re.compile(r"""
|
||||
# r"(\d\d\d\d#X?\d+\w?|1995-96kh|92-94Surveybookkh|1991surveybook|smkhs)/(.*?(?:png|jpg|pdf|jpeg|gif|txt))$", path
|
||||
@@ -74,7 +83,7 @@ def parse_tnl_file(dwgfile, path):
|
||||
if mscansdir := rx_wallet.search(path): # walrus
|
||||
# print(f"{path} -- {mscansdir.group(1)=} -- {mscansdir.group(2)=}")
|
||||
scanswalletl = Wallet.objects.filter(walletname=mscansdir.group(1))
|
||||
# This should be changed to properly detect if a list of folders is returned and do something sensible, not just pick the first.
|
||||
# This should be changed to properly detect if a list of folders is returned and do something sensible, not just pick the first. e.g. use the __in Django idiom
|
||||
if len(scanswalletl):
|
||||
wallet = scanswalletl[0]
|
||||
if len(scanswalletl) > 1:
|
||||
@@ -125,7 +134,7 @@ def findwalletimage(therionfile, foundpath):
|
||||
mscansdir = rx_wallet.search(foundpath)
|
||||
if mscansdir:
|
||||
scanswalletl = Wallet.objects.filter(walletname=mscansdir.group(1))
|
||||
# This should be changed to properly detect if a list of folders is returned and do something sensible, not just pick the first.
|
||||
# This should be changed to properly detect if a list of folders is returned and do something sensible, not just pick the first. Use the __in idom
|
||||
if len(scanswalletl):
|
||||
wallet = scanswalletl[0]
|
||||
if len(scanswalletl) > 1:
|
||||
@@ -163,14 +172,6 @@ def findimportinsert(therionfile, imp):
|
||||
pass
|
||||
|
||||
|
||||
rx_xth_me = re.compile(r"xth_me_image_insert.*{.*}$", re.MULTILINE)
|
||||
rx_scrap = re.compile(r"^survey (\w*).*$", re.MULTILINE)
|
||||
rx_input = re.compile(r"^input ", re.MULTILINE)
|
||||
rx_line = re.compile(r"^line ", re.MULTILINE)
|
||||
rx_ref = re.compile(r"^#?\s?ref\s*\:?\s*([^\s\t]*)", re.MULTILINE)
|
||||
# ref:
|
||||
|
||||
|
||||
def settherionfileinfo(filetuple):
|
||||
"""Read in the drawing file contents and sets values on the dwgfile object"""
|
||||
thtype, therionfile = filetuple
|
||||
@@ -231,11 +232,6 @@ def settherionfileinfo(filetuple):
|
||||
therionfile.save()
|
||||
|
||||
|
||||
rx_skpath = re.compile(r"<skpath")
|
||||
rx_pcpath = re.compile(r'<pcarea area_signal="frame".*?sfsketch="([^"]*)" sfstyle="([^"]*)"')
|
||||
rx_pctext = re.compile(r'pctext.*?\*ref&space;([^&]*)')
|
||||
|
||||
|
||||
def settnlfileinfo(dwgfile):
|
||||
"""Read in the drawing file contents and sets values on the dwgfile object
|
||||
Should try to read the date too e.g. tunneldate="2010-08-16 22:51:57
|
||||
|
||||
Reference in New Issue
Block a user